* @package HTML_QuickForm_advmultiselect
* @subpackage Examples
* @access public
* @example examples/qfams_basic_1.php
* qfams_basic_1 source code
* @link http://www.laurent-laville.org/img/qfams/screenshot/basic1.png
* screenshot (Image PNG, 406x247 pixels) 4.95 Kb
*/
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/advmultiselect.php';
$form = new HTML_QuickForm('amsBasic1');
$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');
$car_array = array(
'dodge' => 'Dodge',
'chevy' => 'Chevy',
'bmw' => 'BMW',
'audi' => 'Audi',
'porsche' => 'Porsche',
'kia' => 'Kia',
'subaru' => 'Subaru',
'mazda' => 'Mazda',
'isuzu' => 'Isuzu',
);
// rendering with all default options
$form->addElement('header', null, 'Advanced Multiple Select: default layout ');
$form->addElement('advmultiselect', 'cars', 'Cars:', $car_array);
if (isset($_POST['cars'])) {
$form->setDefaults(array('cars' => $_POST['cars']));
}
$form->addElement('submit', 'send', 'Send');
?>
HTML_QuickForm::advMultiSelect basic example 1
validate()) {
$clean = $form->getSubmitValues();
echo '';
print_r($clean);
echo '
';
}
$form->display();
?>