cvs: pear /HTML_QuickForm_advmultiselect/examples qfams_basic_1.php qfams_basic_2.php qfams_custom_1.php qfams_custom_2.php qfams_custom_3.php qfams_custom_5.php qfams_multiple_1.php

[email protected] ("Laurent Laville")
Newsgroups php.pear.cvs
Message-ID <cvsfarell1209230759@cvsserver>
farell		Sat Apr 26 17:25:59 2008 UTC

  Modified files:              
    /pear/HTML_QuickForm_advmultiselect/examples	qfams_basic_1.php 
                                                	qfams_basic_2.php 
                                                	qfams_custom_1.php 
                                                	qfams_custom_2.php 
                                                	qfams_custom_3.php 
                                                	qfams_custom_5.php 
                                                	qfams_multiple_1.php 
  Log:
  With default element template there is a label, that does not exist with submit button
  On all examples uses a custom submit-element template to make them XHTML compliant
farell-20080426172559.txt (text/plain, 13.2 KB)
http://cvs.php.net/viewvc.cgi/pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_1.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_1.php
diff -u pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_1.php:1.3 pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_1.php:1.4
--- pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_1.php:1.3	Fri Jan  5 15:35:33 2007
+++ pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_1.php	Sat Apr 26 17:25:59 2008
@@ -3,7 +3,7 @@
  * Basic advMultiSelect HTML_QuickForm element
  * without any customization.
  *
- * @version    $Id: qfams_basic_1.php,v 1.3 2007/01/05 15:35:33 farell Exp $
+ * @version    $Id: qfams_basic_1.php,v 1.4 2008/04/26 17:25:59 farell Exp $
  * @author     Laurent Laville <[email protected]>
  * @package    HTML_QuickForm_advmultiselect
  * @subpackage Examples
@@ -20,6 +20,23 @@
 $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
+<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');
+
 $car_array = array(
     'dodge'     =>  'Dodge',
     'chevy'     =>  'Chevy',
@@ -42,7 +59,6 @@
 }
 
 $form->addElement('submit', 'send', 'Send');
-
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
http://cvs.php.net/viewvc.cgi/pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_2.php?r1=1.2&r2=1.3&diff_format=u
Index: pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_2.php
diff -u pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_2.php:1.2 pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_2.php:1.3
--- pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_2.php:1.2	Fri Jan  5 15:35:33 2007
+++ pear/HTML_QuickForm_advmultiselect/examples/qfams_basic_2.php	Sat Apr 26 17:25:59 2008
@@ -3,7 +3,7 @@
  * Basic advMultiSelect HTML_QuickForm element without any customization.
  * Load options from a database.
  *
- * @version    $Id: qfams_basic_2.php,v 1.2 2007/01/05 15:35:33 farell Exp $
+ * @version    $Id: qfams_basic_2.php,v 1.3 2008/04/26 17:25:59 farell Exp $
  * @author     Laurent Laville <[email protected]>
  * @package    HTML_QuickForm_advmultiselect
  * @subpackage Examples
@@ -39,6 +39,23 @@
 $form = new HTML_QuickForm('amsBasic2');
 $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');
+
 $form->addElement('header', null, 'Advanced Multiple Select: default layout ');
 
 $ams =& $form->addElement('advmultiselect', 'user',
http://cvs.php.net/viewvc.cgi/pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_1.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_1.php
diff -u pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_1.php:1.3 pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_1.php:1.4
--- pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_1.php:1.3	Fri Jan  5 15:35:33 2007
+++ pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_1.php	Sat Apr 26 17:25:59 2008
@@ -6,7 +6,7 @@
  * The template allows to add label as headers of dual select box
  * and moves the button to another location (below each select box).
  *
- * @version    $Id: qfams_custom_1.php,v 1.3 2007/01/05 15:35:33 farell Exp $
+ * @version    $Id: qfams_custom_1.php,v 1.4 2008/04/26 17:25:59 farell Exp $
  * @author     Laurent Laville <[email protected]>
  * @package    HTML_QuickForm_advmultiselect
  * @subpackage Examples
@@ -23,6 +23,23 @@
 $form = new HTML_QuickForm('amsCustom1');
 $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',
@@ -70,7 +87,6 @@
 }
 
 $form->addElement('submit', 'send', 'Send');
-
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
http://cvs.php.net/viewvc.cgi/pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_2.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_2.php
diff -u pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_2.php:1.3 pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_2.php:1.4
--- pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_2.php:1.3	Fri Jan  5 15:35:33 2007
+++ pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_2.php	Sat Apr 26 17:25:59 2008
@@ -6,7 +6,7 @@
  * The template allows to add label as headers of dual select box
  * and moves the buttons between the two select box (up and down).
  *
- * @version    $Id: qfams_custom_2.php,v 1.3 2007/01/05 15:35:33 farell Exp $
+ * @version    $Id: qfams_custom_2.php,v 1.4 2008/04/26 17:25:59 farell Exp $
  * @author     Laurent Laville <[email protected]>
  * @package    HTML_QuickForm_advmultiselect
  * @subpackage Examples
@@ -23,6 +23,23 @@
 $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
+<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',
@@ -69,7 +86,6 @@
 }
 
 $form->addElement('submit', 'send', 'Send');
-
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
http://cvs.php.net/viewvc.cgi/pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_3.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_3.php
diff -u pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_3.php:1.3 pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_3.php:1.4
--- pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_3.php:1.3	Fri Jan  5 15:35:33 2007
+++ pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_3.php	Sat Apr 26 17:25:59 2008
@@ -3,7 +3,7 @@
  * Custom advMultiSelect HTML_QuickForm element
  * loading values with fancy attributes (disabled, ...)
  *
- * @version    $Id: qfams_custom_3.php,v 1.3 2007/01/05 15:35:33 farell Exp $
+ * @version    $Id: qfams_custom_3.php,v 1.4 2008/04/26 17:25:59 farell Exp $
  * @author     Laurent Laville <[email protected]>
  * @package    HTML_QuickForm_advmultiselect
  * @subpackage Examples
@@ -20,6 +20,23 @@
 $form = new HTML_QuickForm('amsCustom3');
 $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',
@@ -73,7 +90,6 @@
 }
 
 $form->addElement('submit', 'send', 'Send');
-
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
http://cvs.php.net/viewvc.cgi/pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_5.php?r1=1.4&r2=1.5&diff_format=u
Index: pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_5.php
diff -u pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_5.php:1.4 pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_5.php:1.5
--- pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_5.php:1.4	Fri Jan  5 15:35:33 2007
+++ pear/HTML_QuickForm_advmultiselect/examples/qfams_custom_5.php	Sat Apr 26 17:25:59 2008
@@ -3,7 +3,7 @@
  * Custom advMultiSelect HTML_QuickForm element
  * that allows to manage sort of select boxes.
  *
- * @version    $Id: qfams_custom_5.php,v 1.4 2007/01/05 15:35:33 farell Exp $
+ * @version    $Id: qfams_custom_5.php,v 1.5 2008/04/26 17:25:59 farell Exp $
  * @author     Laurent Laville <[email protected]>
  * @package    HTML_QuickForm_advmultiselect
  * @subpackage Examples
@@ -20,6 +20,23 @@
 $form = new HTML_QuickForm('amsCustom5');
 $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, 'validate');
+
 $fruit_array = array(
     'apple'     =>  'Apple',
     'orange'    =>  'Orange',
@@ -54,7 +71,7 @@
 $form->addGroup($arrange, 'autoArrange', 'Sort list:');
 $form->setDefaults(array('autoArrange' => 'N'));
 
-$validate =& $form->addElement('submit', null, 'Validate');
+$form->addElement('submit', 'validate', 'Validate');
 
 $form->addElement('header', null, 'Advanced Multiple Select: custom layout ');
 
@@ -96,7 +113,7 @@
 
 $buttons[] =& $form->createElement('submit', null, 'Submit');
 $buttons[] =& $form->createElement('reset',  null, 'Reset');
-$form->addGroup($buttons);
+$form->addGroup($buttons, null, '&nbsp;');
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
http://cvs.php.net/viewvc.cgi/pear/HTML_QuickForm_advmultiselect/examples/qfams_multiple_1.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/HTML_QuickForm_advmultiselect/examples/qfams_multiple_1.php
diff -u pear/HTML_QuickForm_advmultiselect/examples/qfams_multiple_1.php:1.3 pear/HTML_QuickForm_advmultiselect/examples/qfams_multiple_1.php:1.4
--- pear/HTML_QuickForm_advmultiselect/examples/qfams_multiple_1.php:1.3	Fri Jan  5 15:35:33 2007
+++ pear/HTML_QuickForm_advmultiselect/examples/qfams_multiple_1.php	Sat Apr 26 17:25:59 2008
@@ -3,7 +3,7 @@
  * Mixed advMultiSelect HTML_QuickForm elements.
  * Two widgets on the same page/form with each its own javascript function
  *
- * @version    $Id: qfams_multiple_1.php,v 1.3 2007/01/05 15:35:33 farell Exp $
+ * @version    $Id: qfams_multiple_1.php,v 1.4 2008/04/26 17:25:59 farell Exp $
  * @author     Laurent Laville <[email protected]>
  * @package    HTML_QuickForm_advmultiselect
  * @subpackage Examples
@@ -20,6 +20,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',
@@ -75,7 +92,6 @@
 }
 
 $form->addElement('submit', 'send', 'Send');
-
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.