[phplib-dev] cvs commit From: uw (phplib-dev <email protected>)
Date: 05/13/01

From: uw
Date: Sun May 13 20:55:07 2001
Modified files:
      php-lib/php/form/form.inc
      php-lib/php/form/form_xmlfactory.inc

Log message:
- fixed a typo
- fixed handling of linebreaks etc within a xml document

Index: php-lib/php/form/form.inc
diff -u php-lib/php/form/form.inc:1.27 php-lib/php/form/form.inc:1.28
--- php-lib/php/form/form.inc:1.27 Sun May 13 17:52:55 2001
+++ php-lib/php/form/form.inc Sun May 13 20:54:36 2001
@@ -28,7 +28,7 @@
 * - tree (select box with options show as a tree)
 *
 *  <email protected> Ulf Wendel <ulf.wendel <email protected>>
-*  <email protected> $Id: form.inc,v 1.27 2001/05/13 15:52:55 uw Exp $
+*  <email protected> $Id: form.inc,v 1.28 2001/05/13 18:54:36 uw Exp $
 *  <email protected> public
 *  <email protected> Form
 */
@@ -459,11 +459,10 @@
                         $method = "POST";
                 }
                 
- if ($js_name) {
- $this->js_name = $js_name;
+ if ($this->js_name) {
                         $html .= sprintf('name="%s" onSubmit="return _%s.validate();" ',
- $js_name,
- $js_name
+ $this->js_name,
+ $this->js_name
                                                                                         );
                 }
                 
@@ -713,10 +712,10 @@
                 foreach ($this->getCustomValidators($vallist) as $k => $validator)
                         $this->${validator}();
 
- foreach ($vallist as $k => $name)
+ foreach ($vallist as $k => $name)
                         if (isset($this->elements[$name]) && $message = $this->elements[$name]->validate())
                                 $this->setValidationError($name, $message);
-
+
                 return $this->getValidationResult();
         } // end func validate
         
@@ -853,7 +852,6 @@
         *  <email protected> form_error
         */
         function getJS() {
-
                 if ("" == $this->js_name)
                         return "";
         
Index: php-lib/php/form/form_xmlfactory.inc
diff -u php-lib/php/form/form_xmlfactory.inc:1.5 php-lib/php/form/form_xmlfactory.inc:1.6
--- php-lib/php/form/form_xmlfactory.inc:1.5 Sun May 13 18:15:26 2001
+++ php-lib/php/form/form_xmlfactory.inc Sun May 13 20:54:36 2001
@@ -376,11 +376,10 @@
       
       case "form":
 
- $js_name = (isset($attr["jsname"])) ? $attr["jsname"] : "";
- $method = (isset($attr["method"])) ? $attr["method"] : "";
- $action = (isset($attr["action"])) ? $attr["action"] : "";
- $name = (isset($attr["name"])) ? $attr["name"] : "";
-
+ $js_name = (isset($attrs["jsname"])) ? $attrs["jsname"] : "";
+ $method = (isset($attrs["method"])) ? $attrs["method"] : "";
+ $action = (isset($attrs["action"])) ? $attrs["action"] : "";
+ $name = (isset($attrs["name"])) ? $attrs["name"] : "";
         $this->form = new form($js_name, $method, $action, $name);
         break;
         
@@ -499,10 +498,22 @@
   /**
   * XML parser character data (= content) handler
   *
+ * WARNING: whatever content there it it will be only
+ * used if trim($cdata) is not empty! I need this rule
+ * to handle linebreaks and whitespace which otherwise
+ * lead to strange results.
+ *
   *  <email protected> resource xml parser
   *  <email protected> string cdata
   */
   function cdata($parser, $cdata) {
+
+ // WARNING
+ if ("" == trim($cdata))
+ return;
+
+ // Hmm, do you know a better way?
+ $cdata = trim($cdata);
     
     switch ($this->current_tag) {
     

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>