Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

0

Simply create a key inside $form_state that will keep track if ajax has ran. function xyz_custom_form($form, &$form_state){ if (empty($form_state['ajax_ran']) { $form_state['ajax_ran'] = FALSE; } $form['field_B'] = array( '#type' => 'radios', '#options' => array("a"=>"A", "b"=>"B", "c"=>"C"), '#prefix' => "<...


0

If you need a entity (which could be a node) to be created whenever the form is loaded, can create the enitiy, and pass it to your form, rather than creating it within your form. Then you can also use the same form for editing the entity. For example, in a module called nodeform: function nodeform_menu() { $menu['nodeform/add'] = [ 'title' => '...


0

I had this same issue, what worked for me was under webform settings > Confirmation > Confirmation Type. Change the confirmation type to 'Inline (reloads the current page and replaces the webform with the confirmation message)' This returned true for $event->getResponse()->getWebformSubmission()->isCompleted()


2

If Ajax reloads this part you are hiding, the marker once() has set is overwritten, also the show/hide status. Then you need a different approach, either submit the show/hide status, so that it can be returned by Ajax, or create a show/hide Ajax form element to have full control over it through Ajax. If this is outside of the Ajax wrapper you can do this in ...


1

Your form is a ContentEntityForm, so you need to use the entity form builder service, e.g.: $entity = /** create or load your entity **/ $entity_form = \Drupal::service('entity.form_builder') ->getForm($entity, 'default');


0

In order to make this work properly as well as in IE, I had to trigger a function onChange rather than calling it in the closure directly. $('#edit-emp-lname').change(function() { doChange(); }).attr("onchange", function() { doChange(); }).blur( function() { doChange(); }); function doChange() { var empName = $('#edit-emp-lname').val(); var empArray ...


2

Here is the proper way of adding glyphicons to your buttons, you alter the button function and use a custom made one. function mymodule_theme_registry_alter(&$theme_registry) { if (isset($theme_registry['button'])) { $theme_registry['button']['function'] = 'mymodule_button'; } } function mymodule_button($variables) { $element = $variables['...


0

Drupal.behaviors.myBehavior = { attach: function (context, settings) { $( "#form #submit-button" ).click(function( event ) { event.preventDefault(); }); } }; Can you try like this. This will trigger for every AJAX call.


0

If you are using Drupal 7 - what you are looking for might be module custom_price, or Rules module(maybe with conditional_rules extension). If you are using Drupal 8 - your options are either Rules module or writing a whole custom module that will be intercepting showed and calculated price based on specific rules that you would create.


Top 50 recent answers are included