* @package HTML_QuickForm_advmultiselect * @subpackage Examples * @access public * @example examples/qfams_custom_2.php * qfams_custom_2 source code * @link http://www.laurent-laville.org/img/qfams/screenshot/custom2.png * screenshot (Image PNG, 374x302 pixels) 5.80 Kb */ require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/advmultiselect.php'; $form = new HTML_QuickForm('amsCustom2'); $form->removeAttribute('name'); // XHTML compliance // same as default element template but wihtout the label (in first td cell) $withoutLabel = <<<_HTML   {error}
{element} _HTML; // more XHTML compliant // replace default element template with label, because submit button have no label $renderer =& $form->defaultRenderer(); $renderer->setElementTemplate($withoutLabel, 'send'); $fruit_array = array( 'apple' => 'Apple', 'orange' => 'Orange', 'pear' => 'Pear', 'banana' => 'Banana', 'cherry' => 'Cherry', 'kiwi' => 'Kiwi', 'lemon' => 'Lemon', 'lime' => 'Lime', 'tangerine' => 'Tangerine', ); // rendering with QF renderer engine and template system $form->addElement('header', null, 'Advanced Multiple Select: custom layout '); $ams =& $form->addElement('advmultiselect', 'fruit', null, $fruit_array, array('size' => 5, 'class' => 'pool', 'style' => 'width:300px;' ) ); $ams->setLabel(array('Fruit:', 'Available', 'Selected')); $ams->setButtonAttributes('add', array('type' => 'image', 'src' => '/img/qfams/down.png')); $ams->setButtonAttributes('remove', array('type' => 'image', 'src' => '/img/qfams/up.png')); // vertical select box with image buttons as selector $template = ' {label_2} {unselected} {add}{remove} {selected} {label_3} '; $ams->setElementTemplate($template); if (isset($_POST['fruit'])) { $form->setDefaults(array('fruit' => $_POST['fruit'])); } $form->addElement('submit', 'send', 'Send'); ?> HTML_QuickForm::advMultiSelect custom example 2 getElementJs(false); ?> validate()) { $clean = $form->getSubmitValues(); echo '
';
    print_r($clean);
    echo '
'; } $form->display(); ?>