[Dancer-users] Keeping values on a form
ambs
ambs+dancer at perl-hackers.net
Thu Dec 16 22:06:31 CET 2010
Hi
This is not really a Dancer problem, but something that I am missing
when changing from CGI to Dancer + TemplateToolkit.
Basically:
- I have a form with an array of checkboxes
- that form gets submitted
- some results are shown, together with the form for resubmission
The question is, how do I keep the checkboxes checked (or not)
accordingly with what the user picked before submitting it?
For reference, CGI called this behavior as stiky: By default the CGI
module implements a state-preserving behavior called "sticky" fields.
The way this works is that if you are regenerating a form, the methods
that generate the form field values will interrogate param() to see if
similarly-named parameters are present in the query string. If they find
a like-named parameter, they will use it to set their default values.
Thank you
ambs
More information about the Dancer-users
mailing list