In my module's admin configuration page, I have a simple textfield that needs to be filled out before any other input of the form even appears. I thought that this could be done by adding a small button next to the textfield that, when pressed, will perform all the validation that I need (I have already created the functions that will be used) and then additional "select" form elements will be generated. Anyone knows how I can do this?
- You can use
#limit_validation_errorsto limit the fields validated when a form is submitted with the button you add.
- If you set
$form_state['rebuild']in the validation handler you add for the button the form will be rendered again instead of being submitted.
- Then all you have to do it add some logic to the form that will display the extra fields. This can be done with the data in the
if its not too complicated business logic you can look into the
#states value for FAPI elements. See this is article as an example.