By zythar on
i found, that after submiting form, items that are #disabled are not present in $form_state['values'].
but i need it. variant of making textfield (in my case) editable cant be taken.
i found, that after submiting form, items that are #disabled are not present in $form_state['values'].
but i need it. variant of making textfield (in my case) editable cant be taken.
Comments
i found that i can get needed
i found that i can get needed value by using $form['my_field']['#default_value'] but i dont think that it is right..
one workaround, not sure it is best
Create hidden fields with the values you really want, and make your non-editable textfields with different names, so they show but you don't need them.
Other than that, not sure, I think if you make it disabled, the value does not come through.
Another alternative is to use jquery to make it disable after rendering rather than doing it in Drupal form definitions, but that is subject to visitors having javascript on.
i used variant with hidden
i used variant with hidden fields. thanks very much.
its funny that i couldnt come to that myself...
Careful with hidden values.
Careful with hidden values. They can be modified using javascript. Your first solution is safer. Or, if you like the hidden solution then make them of type 'value':
yes
You should always still validate your data to make sure it is what you expect, even when you try to prevent the user from modifying the value.
i had exactly the same but i
i had exactly the same but i can do it using a textarea put rows to 1 and i dont know why i dont lose my data in validations ..... i was checking and D7 had the same
The only source of knowledge is experience. ~ Albert Einstein.