* @package HTML_QuickForm_advmultiselect * @subpackage Examples * @access public * @example examples/qfams_template_1.php * qfams_template_1 source code * @link http://www.laurent-laville.org/img/qfams/screenshot/template1.png * screenshot (Image PNG, 665x376 pixels) 23.3 Kb */ require_once 'HTML/Template/Sigma.php'; require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/Renderer/ITDynamic.php'; require_once 'HTML/QuickForm/advmultiselect.php'; $form = new HTML_QuickForm('amsTemplate1'); $form->removeAttribute('name'); // XHTML compliance $fruit_array = array( 'apple' => 'Apple', 'orange' => 'Orange', 'pear' => 'Pear', 'banana' => 'Banana', 'cherry' => 'Cherry', 'kiwi' => 'Kiwi', 'lemon' => 'Lemon', 'lime' => 'Lime', 'tangerine' => 'Tangerine', ); // rendering with css selectors and API selLabel(), setButtonAttributes() $form->addElement('header', null, 'Advanced Multiple Select: custom layout '); $form->addElement('text', 'name', 'Name:', array('size' => 40, 'maxlength' => 80)); $ams =& $form->addElement('advmultiselect', 'fruit', null, $fruit_array, array('size' => 15, 'class' => 'pool', 'style' => 'width:150px;' ) ); $ams->setLabel(array('Fruit:', 'Available', 'Selected')); $ams->setButtonAttributes('add', array('value' => 'Add >>', 'class' => 'inputCommand' )); $ams->setButtonAttributes('remove', array('value' => '<< Remove', 'class' => 'inputCommand' )); $template = '
{label_2} | {label_3} | |
---|---|---|
{unselected} | {add}{remove} | {selected} |
Welcome %s you've selected these fruits:
%s