We can store a permanent value in $form_state
in the submission handler, which will be retained against form errors, but I want to know how we can do it while in the validation handler, where I show an error using form_set_error()
.
In short, I want to show an error in validation with the message "Press submit again to confirm". In this way, if the same form is submitted again it would skip the validation handler.
I can't do it in the submission handler, since it clears the values in the form.
form_set_value()
is not able to retain a value.
EDIT (on 28th Dec)
I've found that $form_state['storage'] is works in validator also only if form_state['rebuild] is set to true. Infact this is how we use in submit handler. And if I call form_set_error in the validator form_state['rebuild] is simply ignored even if it is set and the storage value is not retained.
$form_state
from the validation handler?$form_state
from the validation handler, which is then checked in the validation handler when it is again called.