[dev] cancel button - how to reset a edited horde form

Jan Schneider jan at horde.org
Thu Nov 10 13:46:54 UTC 2016


Zitat von Sebastian Birnbach <birnbacs at gmail.com>:

> I whish to have a 'cancel' button on a Horde_Form.
>
> I added a button and the PHP page evaluates the name of the submitbutton.
> If it is the wrong one (i. e. _("cancel")), the form entries are discarded
> an processing stops. However, the page is not updated to the old values,
> instead the edited (unprocessed) values still show up.
>
> I was wondering if
> * there is something like a reset method for the form (yes, I looked in the
> docs, but not all methods are extensively documented)
> * I can trigger the 'reset' function for which there is a default button
> * I need to keep a copy of the form variables object for reset purposes
> or
> * there is a different mechanism for supporting a cancel button
>
> It seems like a basic thing so there surely is a recommended way of doing
> it.
>
> Kind regards
>
>   Sebastian

Horde_Form#setButtons() has a $reset parameter for that purpose.

-- 
Jan Schneider
The Horde Project
http://www.horde.org/



More information about the dev mailing list