Name
HTML_QuickForm_advmultiselect::setJsElement
- Sets
JavaScript function name parts. Maybe usefull to avoid conflict names
Synopsis
require_once 'HTML/QuickForm/advmultiselect.php';
void HTML_QuickForm_advmultiselect::setJsElement(
|
$pref = NULL,
|
|
|
$post =
'moveSelections') ;
|
|
string
|
$pref = NULL;
|
string
|
$post = 'moveSelections';
|
Description
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.
Parameter
-
string
$pref
-
(optional) Prefix name
-
string
$post
-
(optional) Postfix name
Throws
throws no exceptions thrown
Note
since 0.4.0
This function can not be called statically.
Example
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');
-
-
// ....
-
?>