Skip to main content
9 events
when toggle format what by license comment
Nov 27, 2017 at 13:03 answer added Joum timeline score: 2
Nov 27, 2017 at 13:03 comment added 4uk4 Please go ahead with your answer, sure this will help a lot of people, because ajax callbacks are a bit counterintuitive. I will upvote it.
Nov 27, 2017 at 12:48 comment added Joum @4k4 I got it working with your help and those docs, thank you! If you want to create an answer based on this, I'll be happy to mark it as accepted. I'll write my own though, so I can clear up my misconceptions and hopefully help someone else.
Nov 27, 2017 at 12:20 comment added 4uk4 See the topic "The Big Idea" in drupal.org/docs/7/api/javascript-api/ajax-forms-in-drupal-7
Nov 27, 2017 at 11:53 comment added Joum I'm struggling a bit with your remarks. Can you point me to some documentation regarding this?
Nov 27, 2017 at 10:28 comment added 4uk4 You populate the options in the form rebuild. The form build function knows that it is rebuilding when $form_state is filled with user input, which it is not on the first build.
Nov 27, 2017 at 10:23 comment added Joum @4k4 thanks for your feedback, but I'm not sure what you mean. My dependent select element already exists in the form when it is first built, it just doesn't have the #options populated. After I populate them in the AJAX callback, they show up in the markup, but aren't available in the submit hook to be processed. Can you suggest how to handle this?
Nov 27, 2017 at 10:15 comment added 4uk4 $form is rebuilt in each ajax request before your ajax callback is even invoked. And then in your callback you are only allowed to use form elements from $form, because otherwise the form element is not processed and can't be submitted.
Nov 27, 2017 at 10:05 history asked Joum CC BY-SA 3.0