Linked Questions

5
votes
1answer
1k views

No Ajax gets initialised from inside the modal

I've got a bunch of forms that are opening inside a modal so that the user is not redirected off the page. I've then got a few Ajax calls on form items inside the form. They all work when using the ...
4
votes
1answer
844 views

Prevent dual submit on form submission

I've got a form that submits via AJAX and in the callback I need to rebuild certain parts of the page to reflect the newly submitted data. One of these parts is the form, which I need to clear all ...
3
votes
1answer
1k views

8 - Ajax form not rebuild once submitted

I have an issue with a custom form in Drupal 8, using Ajax. Let me explain. I have two select fields, and when you choose an option in the first one, an Ajax request will get options for the second ...
2
votes
1answer
6k views

Simple AJAX callback fired on form submission button click

I am trying to fire an AJAX callback when the user presses the submit button. This is such a simple thing but trying to debug Drupal's Form AJAX API is driving me crazy. At this point I just need a ...
1
vote
1answer
4k views

Ajax Form submit doesn't work second time

I'm loading the node/edit form in a block and I add ajax on submit. I add the Ajax in the hook_form_alter. $form['#prefix'] = '<div id="' . $form_wrapper . '">'; $form['#suffix'] = '</div&...
1
vote
1answer
2k views

Drupal 8 Ajax Form Submit works only once?

I am trying to create a simple form in D8 that submits with a submit button and then replaces the entire form content via ajax. For some reason, my AJAX submit works perfectly on the first click but ...
0
votes
1answer
868 views

How do I check by default a checkbox from a checkboxes control after an AJAX call

I have the next form which behavior is: When you select an option from select control, different checkbox are load on checkboxes control. When you check/uncheck checkbox a message is showed on the ...
0
votes
1answer
395 views

After an Ajax request that modifies the form it will not pass in the submitForm method

I have a form with 3 dropdowns. When changing the first one, it updates the 2 other by an ajax call. Once the 2 selects are re-rendered, when the user submits the form, it no longer pass in the ...
0
votes
1answer
561 views

How can I give Ajax access to currently set fields on my form?

I'm working on a block form that needs to update certain elements in the form based on what the user selects with certain elements. I've defined the internal class method and it's getting called ...
-1
votes
1answer
2k views

AJAX select returns 'illegal choice detected'

Create a settings form for a module in Drupal 8 - when a user selects a View from a list, the drop down under it should populate with the displays in that view. While the form updates the option list ...
0
votes
0answers
74 views

Form field name not rendered after submit the form

I created a form and designed it by referred this link. It worked fine. I used the following code to display a textbox in my form public function buildForm(array $form, FormStateInterface $...
0
votes
0answers
333 views

AJAX replaced elements not able to callback

I have a form with AJAX elements, generated as follows: $memberForm['members'] = [ '#prefix' => '<div id="'.$id.'">', '#suffix' => '</div>', ]; $form['...
0
votes
0answers
676 views

Drupal8: tableselect form element. Drupal::service('renderer')->render($element) return empty rows

I have custom field widget with two fields: product_lines (checkboxes) sales_partners (tableselect) I need to ajax-reload sales_partners tablesect values depending on product_lines input In my ...
0
votes
0answers
577 views

Ajax call with Submit loses submitted form data

I've built a super simple form in D8 meant to check the format of the field then when submitted the form data is placed in the DB. I check the format using a Ajax call -- yes, I know js is a better ...