4

So I'm trying to do something really simple but haven't manage to know how to do it with the Ajax API form from drupal 7. I have an administrative GUI with a select input type, I set the #ajax property with the callback but I don't want to replace anything just need to reload/refresh the values for specific inputs most of them textfield, when the selection change.

Any insight on how to do this? Can it be done with the Ajax Drupal 7 API?

Thanks....

1

1 Answer 1

2

You should put a wrapper around the fields of which you want to reload/refresh (basically replace) and in the call back return the either the form values in an array or the wrapper.

This basically means that on the event specified in the callback, eg change the whole wrapper div is swapped out and replaced with a new one built by the php in your form.

2
  • 1
    can you add more details?
    – user7282
    Commented May 10, 2013 at 11:53
  • 1
    @user7282 - Look inside Examples module, there you get what you want. Look for the Form API Examples. There's at least one Ajax example.
    – leymannx
    Commented Sep 27, 2015 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.