Quickform/Smart dynamic element array...
| From: | john dot f dot kline at att dot net | Date: | Mon, 14 Mar 2005 05:48:16 +0000 |
| Subject: | Quickform/Smart dynamic element array... | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-18017@lists.php.net to get a copy of this message | ||
I would like to dynamically add an array of radio button questions to a form and template it using
smarty:
$yorns = array('yornRadio1','yornRadio2','yornRadio3');
foreach($yorns as $key) {
$label = 'Do you like radio buttons'.$key.'?';
$questionId = 'yornRadio'.$key;
$this->_form->addGroup($htmlElementFactory->getElementGroup(HEF_YORN_RADIO),
$questionId, $label);
$this->_form->addRule($questionId, 'Check Yes or No', 'required', null,
'client');
}
How can I use a foreach (or section) in smarty to handle a dynamic array of elements?
Thanks,
Jack