I dont understand the problem im facing.
I'm building a big form (in which you can add products, modify quantity, etc etc and validate.
I'm getting consistency data problem between what's in
$form_state['values'] and what's in
$form_state['values'] are never up-to-date ...
if I change a quantity field value, and then validate the ofrm, I will find the right quantity in
$form_state['input'] but not in
Say it passes the validation step, if I submit a second time the form, then I will have the correct values in
Another example : The validation fails if a quantitu is set to 0. When the form display itself after the failure, all quantity fields are reset to the value they were after the previous form loading (Am I clear enough ?)
I dont understand what could make this happen ...
Found this post : When are '$form_state['values'] copied to '$form' on rebuild?
Petroll commented it :
When you submit a form with user input, the input gets stored in $form_state['input'] and later (after validation) in $form_state['values']. But when you, then, rebuild the form, the values are (and AFAIK have to be) are ?somehow? given as parameters to element process functions (that create the FAPI arrays of elements).
That make sense... If validation fails,
$form_state['values'] is not updated with
$form_state['input']. So the form is rebuild with the old values.
But What I dont understand is why all the values are reseted ...
Lets say Ive 5 products. If I modify each quantity, and I set one of them to 0, the validation will fail and all my inputs will be lost.