Ticket #635: 635-jForms-add-support-of-the-required-attribute-on-checkebox.diff
| File 635-jForms-add-support-of-the-required-attribute-on-checkebox.diff, 2.2 kB (added by Julien, 4 months ago) |
|---|
-
lib/jelix/forms/jFormsCompiler_jf_1_0.class.php
old new 3 3 * @package jelix 4 4 * @subpackage forms 5 5 * @author Laurent Jouanneau 6 * @contributor Loic Mathaud, Dominique Papin 6 * @contributor Loic Mathaud, Dominique Papin, Julien Issler 7 7 * @contributor Uriel Corfa Emotic SARL 8 8 * @copyright 2006-2008 Laurent Jouanneau 9 9 * @copyright 2007 Loic Mathaud, 2007 Dominique Papin 10 10 * @copyright 2007 Emotic SARL 11 * @copyright 2008 Julien Issler 11 12 * @link http://www.jelix.org 12 13 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 13 14 */ … … 185 186 $source[]='$ctrl->valueOnUncheck=\''.str_replace("'","\\'", $attributes['valueonuncheck']) ."';"; 186 187 unset($attributes['valueonuncheck']); 187 188 } 189 $this->attrRequired($source, $attributes); 188 190 return false; 189 191 } 190 192 -
lib/jelix/forms/jFormsControl.class.php
old new 3 3 * @package jelix 4 4 * @subpackage forms 5 5 * @author Laurent Jouanneau 6 * @contributor Loic Mathaud, Dominique Papin 6 * @contributor Loic Mathaud, Dominique Papin, Julien Issler 7 7 * @copyright 2006-2008 Laurent Jouanneau, 2007 Dominique Papin 8 8 * @copyright 2007 Loic Mathaud 9 * @copyright 2008 Julien Issler 9 10 * @link http://www.jelix.org 10 11 * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file 11 12 */ … … 222 223 223 224 function check(){ 224 225 $value = $this->container->data[$this->ref]; 226 if($this->required && $value == $this->valueOnUncheck) 227 return $this->container->errors[$this->ref] = jForms::ERRDATA_REQUIRED; 225 228 if($value != $this->valueOnCheck && $value != $this->valueOnUncheck) 226 229 return $this->container->errors[$this->ref] = jForms::ERRDATA_INVALID; 227 230 return null;
