![]() HTML_QuickForm_advmultiselect : The Definitive Guide
|
HTML_QuickForm_advmultiselect::setJsElement
— Sets JavaScript function name parts. Maybe usefull to avoid conflict names
require_once 'HTML/QuickForm/advmultiselect.php';
void HTML_QuickForm_advmultiselect::setJsElement( |
$pref = NULL, | |
$post = 'moveSelections') ; |
string | $pref = NULL; |
string | $post = 'moveSelections'; |
If you want to change the name of the JavaScript functions that manage items from one list to the other one, for any reason (follow project coding, avoid conflict name, ...), you can do it. The main default function name is moveSelections, without prefix.
While default JavaScript function names are : moveSelections, updateHidden, moveUp, moveDown, moveSwap , in this example, the prefix is set to 'fruit' and the main function is called 'Selection', and others ones are: fruitupdateHidden, fruitmoveUp, fruitmoveDown, fruitmoveSwap
<?php require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/advmultiselect.php'; $form = new HTML_QuickForm('ams'); $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', ); $ams =& $form->addElement('advmultiselect', 'fruit', null, $fruit_array); $ams->setLabel(array('Fruit:', 'Available', 'Selected')); $ams->setJsElement('fruit', 'Selection'); // .... ?>
HTML_QuickForm_advmultiselect : The Definitive Guide | v 1.1.0 : December 1, 2005 |