[dancer-users] Template Toolkit Help

Richard Reina gatorreina at gmail.com
Thu Oct 1 22:10:47 BST 2015

2015-09-21 13:20 GMT-05:00 Andrew Beverley <andy at andybev.com>:

> On Mon, 2015-09-21 at 13:09 -0500, Richard Reina wrote:
> > I have learned how to display variables in template toolkit with <%
> > varname %>. However, these variables are being named from withing my
> > dancer app and displayed on the template. Is there a way to display
> > variables that a user is entering as they are entering it.
> Not as part of TT - that all happens server side.
> >  So that if I have a menu like form where a user can pick several
> > items and see them each added one by one in a list format before
> > pressing a second submit button that submits his entire lists of
> > entries? It would be a bit like a shopping cart but instead of the
> > items being put in the cart they are displayed right there in the form
> > as they are added.
> In which case you have 2 options:
> 1. Process it client-side with javascript (not recommended)
> 2. Make each "addition" a new request, and store server-side
> You could also do a combination with AJAX-type calls, which is probably
> the best "modern" way of doing it, although it will be more complicated
> than option 2.
> Andy
I have gone the with option 2. Basically I have two forms in the template.
Form 1 lets the user add an item. Form 2 keeps a running tally of the items
thus far added. What I can't figure out is how to make dancer differentiate
between the two forms so that it knows that the user is done adding items
and wants to check out so to speak he can hit the submit button of Form 2
to save all his submissions. Both forms have submit buttons but I am not
sure how to make the POST route understand that the user is done with the
form so that I can in turn make it save the data.

Thanks for any ideas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20151001/24480964/attachment.html>

More information about the dancer-users mailing list