Changeset 1122
- Timestamp:
- 10/16/08 21:57:53 (3 months ago)
- Files:
-
- branches/1.0.x/lib/jelix-www/js/jforms.js (modified) (2 diffs)
- branches/1.0.x/lib/jelix/forms/jFormsControl.class.php (modified) (4 diffs)
- branches/1.0.x/testapp/modules/jelix_tests/tests/jforms.check_datas.html_cli.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsControl.class.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0.x/lib/jelix-www/js/jforms.js
r952 r1122 3 3 * @subpackage forms 4 4 * @author Laurent Jouanneau 5 * @contributor Julien Issler 5 * @contributor Julien Issler, Dominique Papin 6 6 * @copyright 2007 Laurent Jouanneau 7 * @copyright 2008 Julien Issler 7 * @copyright 2008 Julien Issler, 2008 Dominique Papin 8 8 * @link http://www.jelix.org 9 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 60 60 if (!elt) continue; // sometimes, all controls are not generated... 61 61 var val = this._getValue(elt); 62 if(val == ''){ 62 var trimVal = val; 63 if (val.replace) 64 var trimVal = val.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 65 if(trimVal == ''){ 63 66 if(c.required){ 64 67 f.errorDecorator.addError(c, 1); branches/1.0.x/lib/jelix/forms/jFormsControl.class.php
r1020 r1122 5 5 * @author Laurent Jouanneau 6 6 * @contributor Loic Mathaud, Dominique Papin 7 * @copyright 2006-2007 Laurent Jouanneau, 2007 Dominique Papin7 * @copyright 2006-2007 Laurent Jouanneau, 2007-2008 Dominique Papin 8 8 * @copyright 2007 Loic Mathaud 9 9 * @link http://www.jelix.org … … 39 39 40 40 function check($value, $form){ 41 if( $value== '') {41 if(trim($value) == '') { 42 42 if($this->required) 43 43 return jForms::ERRDATA_REQUIRED; … … 115 115 } 116 116 }else{ 117 if( $value== ''){117 if(trim($value) == ''){ 118 118 if($this->required) 119 119 return jForms::ERRDATA_REQUIRED; … … 165 165 } 166 166 }else{ 167 if( $value== '' && $this->required){167 if(trim($value) == '' && $this->required){ 168 168 return jForms::ERRDATA_REQUIRED; 169 169 }elseif(!$this->datatype->check($value)){ branches/1.0.x/testapp/modules/jelix_tests/tests/jforms.check_datas.html_cli.php
r851 r1122 4 4 * @subpackage unittest module 5 5 * @author Jouanneau Laurent 6 * @contributor 7 * @copyright 2007 Jouanneau laurent 6 * @contributor Dominique Papin 7 * @copyright 2007 Jouanneau laurent, 2008 Dominique Papin 8 8 * @link http://www.jelix.org 9 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 45 45 $this->assertFalse($this->form->check()); 46 46 $this->form->setData('nom',''); 47 $this->assertFalse($this->form->check()); 48 $this->form->setData('nom',' '); 47 49 $this->assertFalse($this->form->check()); 48 50 $ctrl->required = false; trunk/lib/jelix/forms/jFormsControl.class.php
r1121 r1122 458 458 } 459 459 }else{ 460 if( $value== ''){460 if(trim($value) == ''){ 461 461 if($this->required) 462 462 return $this->container->errors[$this->ref] = jForms::ERRDATA_REQUIRED; … … 493 493 } 494 494 }else{ 495 if( $value== '' && $this->required){495 if(trim($value) == '' && $this->required){ 496 496 return $this->container->errors[$this->ref] = jForms::ERRDATA_REQUIRED; 497 497 }
