[dancer-users] Template Toolkit Help

Andrew Beverley andy at andybev.com
Mon Sep 21 19:20:33 BST 2015


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





More information about the dancer-users mailing list