[dancer-users] Fwd: Template Toolkit Help

Andrew Beverley andy at andybev.com
Fri Oct 2 16:28:01 BST 2015


On Fri, 2015-10-02 at 08:40 -0500, Richard Reina wrote:
> So provided that I have named one button with name="add_entries" and the
> second name="submit_entries" could i just do the following in my dancer 
> app?
> 
> post '/entries_form' => sub {
> 
>     if (defined param('add_entries')) { # the source of this submission 
> was
> the add_entries button
> 
>          # qualify and summarize addition
>           redirect '/entries_form';
> 
>    } elsif (defined param('submit_entries')) {
> 
>      # update submission to make them final
> }

Yes, exactly that.

As an aside, you can lose "defined" (might make the code a little more
readable), as long as you have a value for the submit button.

Andy




More information about the dancer-users mailing list