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@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