PHP Classes

Variable number of fields in form

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  Variable number of fields in form  >  (Un) Subscribe thread alerts  
Subject:Variable number of fields in form
Summary:Variable number of fields in form, using Smarty templates
Messages:3
Author:Alin Vaida
Date:2009-11-15 22:24:31
Update:2009-11-16 01:57:26
 

  1. Variable number of fields in form   Reply   Report abuse  
Picture of Alin Vaida Alin Vaida - 2009-11-15 22:24:31
When using Forms generation as a Smarty plugin, is it possible to have a variable number of fields in the form? I can't figure a way to implement this in the Smarty template, since the plugin uses a prefilter.

Thank you,
Alin

  2. Re: Variable number of fields in form   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-11-15 23:28:00 - In reply to message 1 from Alin Vaida
If the number of fields is variable, you may want to set the field names in an array and use a loop in a template to iterate over the array.

  3. Re: Variable number of fields in form   Reply   Report abuse  
Picture of Alin Vaida Alin Vaida - 2009-11-16 01:57:26 - In reply to message 2 from Manuel Lemos
Since this was the obvious solution, I already tried it. But there was a small error in my script that prevented the input fields to be rendered. Now it's working fine.

Thanks for your quick reply,
Alin