cvs: peardoc /en/package/html/html-quickform-advmultiselect/appendix examples-multiple1.xml

From: Date: Thu, 29 Jan 2009 11:16:11 +0000
Subject: cvs: peardoc /en/package/html/html-quickform-advmultiselect/appendix examples-multiple1.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-11508@lists.php.net to get a copy of this message
farell Thu Jan 29 11:16:11 2009 UTC Modified files: /peardoc/en/package/html/html-quickform-advmultiselect/appendix examples-multiple1.xml Log: sync with qfams_multiple_1.php,v 1.7 : uses only one instance of javascript code http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/appendix/examples-multiple1.xml?r1=1.2&r2=1.3&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/appendix/examples-multiple1.xml diff -u peardoc/en/package/html/html-quickform-advmultiselect/appendix/examples-multiple1.xml:1.2 peardoc/en/package/html/html-quickform-advmultiselect/appendix/examples-multiple1.xml:1.3 --- peardoc/en/package/html/html-quickform-advmultiselect/appendix/examples-multiple1.xml:1.2 Wed Jan 28 22:25:14 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/appendix/examples-multiple1.xml Thu Jan 29 11:16:11 2009 @@ -34,9 +34,9 @@ <?php /** * Mixed advMultiSelect HTML_QuickForm elements. - * Two widgets on the same page/form with each its own javascript function + * Two widgets on the same page/form with one javascript code instance * - * @version $Id: examples-multiple1.xml,v 1.2 2009/01/28 22:25:14 farell Exp $ + * @version $Id: examples-multiple1.xml,v 1.3 2009/01/29 11:16:11 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_QuickForm_advmultiselect * @subpackage Examples @@ -53,6 +53,23 @@ $form = new HTML_QuickForm('amsMultiple1'); $form->removeAttribute('name'); // XHTML compliance +// same as default element template but wihtout the label (in first td cell) +$withoutLabel = <<<_HTML +<tr valign="top"> + <td align="right"> + &nbsp; + </td> + <td align="left"> + <!-- BEGIN error --><span style="color: #ff0000;">{error}</span><br /><!-- END error -->{element} + </td> +</tr> +_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', @@ -81,6 +98,7 @@ $form->addElement('header', null, 'Advanced Multiple Select: default layout '); $ams1 =& $form->addElement('advmultiselect', 'cars', 'Cars:', $car_array); +$ams1->setElementTemplate(null, false); // rendering with css selectors and API selLabel(), setButtonAttributes() $form->addElement('header', null, 'Advanced Multiple Select: custom layout '); @@ -90,7 +108,7 @@ 'class' => 'pool', 'style' => 'width:200px;' ) ); -$ams2->setJsElement('fruit_'); + $ams2->setLabel(array('Fruit:', 'Available', 'Selected')); $ams2->setButtonAttributes('add', array('value' => 'Add', 'name' => 'add1', 'class' => 'inputCommand' @@ -98,6 +116,7 @@ $ams2->setButtonAttributes('remove', array('value' => 'Remove', 'name' => 'remove1', 'class' => 'inputCommand' )); +$ams2->setElementTemplate(null, false); $form->addElement('submit', 'send', 'Send'); ?> @@ -136,17 +155,11 @@ width: 7em; margin-bottom: 2px; } -// --> + --> </style> -<script type="text/javascript"> -<!-- <?php -echo $ams1->getElementJs(); - -echo $ams2->getElementJs(); +echo $ams1->getElementJs(false, true); ?> - --> -</script> </head> <body> <?php

« previous php.pear.doc (#11508) next »