[development] Value of submit button on insert

Dan Robinson dan at drob.org
Fri Aug 29 15:48:07 UTC 2008


"ridenour" on irc helped me with this one. The trick was to modify the
"#value" in form_alter.  I assume it sets the #value and then on form
submit it gets set back to "Save".

Dan
> Folks,
>
> I've written a module and used hook_form to create a form.  I want the
> "Save" button to read "Print Registration Form", not "Save".  If I put
> my own button in:
>
>     $form['#submit'] = array('mymodule_process_registration');
>     $form['#arg'] = $node;
>     $form['#redirect'] = 'registration/complete';
>    
>     $form['submit'] = array(
>         '#type' => 'submit',
>         '#value' => t('Print Registration Form'),
>         '#weight' => -2,
>     )
>
> Then the node won't get inserted because the 'op' is set to 'Print
> Registration Form' instead of 'Save'.  I've looked at using
> hook_validate and hook_nodeapi but no joy there.  Any suggestions?
>
> Thanks,
>
> Dan
>
>   



More information about the development mailing list