[support] More D7 form woes

Jeff Greenberg listmail.ayendesigns at gmail.com
Thu Feb 19 13:23:45 UTC 2015


Dave, beautiful! Thanks for the secret sauce. I kept telling myself, "it's only a html form..."



> On Feb 18, 2015, at 11:13, Metzler, David <metzlerd at evergreen.edu> wrote:
> 
> Sounds like you got it, but it looks like you were struggling with changing values on validation, which I’ve struggled with before so I thought I’d let you know the secret sauce.  It’s the $form_state[‘input’] that people usually miss.
>  
> When changing the values in a validation handler or form rebuilding function do the following:
> 1.)    Change the #default value in the form:
> 2.)    Change the corresponding $form_state[‘values’] element
> 3.)    Change the $form_state[‘input’] element for the same value.
>  
> I usually do this in one statement like:
>  
> $form[‘myfield’][‘#default_value’] = $form_state[‘values’][‘myfield’] = $form_state[‘input’][‘my_field’] = $foo;
>  
> Dave
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20150219/78e9df09/attachment.html 


More information about the support mailing list