By gemini on
Hi everyone,
I'm converting one of my custom modules form version 5.x to 6.x and having some issues with the Forms API.
I have a form that offers criteria selection. After selection and submission, the page reloads with the same form and reflects current selections + outputs the data based on the selected criteria. After upgrading to v6.x - everything works, except when the form is submitted and page reloaded, the form doesn't reflect the currently selected options - all selection are reset to the default state of the form.
I need selections to stay in the form after it's being submitted. Any ideas on how to fix that?
Thank you.
Comments
Add $form_state['rebuild'] =
Add
$form_state['rebuild'] = TRUEto your submit function.Contact me to contract me for D7 -> D10/11 migrations.
Yes, I have relocated that
Yes, I have relocated that part from the form constructor function in version 5.x to form_submit in v.6.x, but that didn't help.
Got it to work by adding
Got it to work by adding $form_state['redirect'] = FALSE; instead of 'rebuild'
I add redirect false but still not working
It display the form when i select the drop down it go to default value it is not remain on last selected option
Same issue
I'm having the same problem, did you fix it?
Just simple form with $form_state['redirect'] = FALSE in the submit handler.
I submit the form and all the values are lost.
I've experimented with $form['#redirect'] = FALSE and it doesn't help.
Having to explicitly set the form default values if the form_state values exist is tedious :\
if you put this in the actual
if you put this in the actual form and not the form submit function it does work and keeps the values on refresh - big help to me thanks! been struggling with this for a while!