Changeset 1069

Show
Ignore:
Timestamp:
08/27/08 23:57:27 (3 months ago)
Author:
laurentj
Message:

jforms: fixed bug on javascript validation, and reduced generated js code size

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix-www/js/jforms.js

    r1054 r1069  
    1717 
    1818// declare a form control 
    19 jForms.tControl = new jFormsControl('name', 'a label', 'datatype'); 
    20 jForms.tControl.required = true; 
    21 jForms.tControl.errInvalid=''; 
    22 jForms.tControl.errRequired=''; 
    23 jForms.tForm.addControl( gControl); 
     19var c = new jFormsControl('name', 'a label', 'datatype'); 
     20c.required = true; 
     21c.errInvalid=''; 
     22c.errRequired=''; 
     23jForms.tForm.addControl(c); 
    2424... 
    2525 
    26 // declare the form now 
     26// declare the form now. A 'submit" event handler will be attached to the corresponding form element 
    2727jForms.declareForm(jForms.tForm); 
    28  
    29 //On a form tag, you should add this onsubmit attribute : 
    30 onsubmit="return jForms.verifyForm(this)" 
    3128 
    3229*/ 
     
    3936 
    4037    tForm: null, 
    41     tControl: null, 
    42     tControl2: null, 
    4338    frmElt: null, 
    4439 
     
    611606 
    612607        var list = this.items[val]; 
     608        var valid = true; 
    613609        for(var i=0; i < list.length; i++) { 
    614610            var val2 = jfrm.getValue(jfrm.frmElt.elements[list[i].name]); 
     
    617613                if (list[i].required) { 
    618614                    jfrm.tForm.errorDecorator.addError(list[i], 1); 
     615                    valid = false; 
    619616                } 
    620617            } else if (!list[i].check(val2, jfrm)) { 
    621618                jfrm.tForm.errorDecorator.addError(list[i], 2); 
    622             } 
    623         } 
    624         return true; 
     619                valid = false; 
     620            } 
     621        } 
     622        return valid; 
    625623    }, 
    626624    activate : function (val) { 
  • trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php

    r1067 r1069  
    158158        echo '<script type="text/javascript"> 
    159159//<![CDATA[ 
     160(function(){var c, c2; 
    160161'.$this->jsContent.' 
     162})(); 
    161163//]]> 
    162164</script>'; 
     
    192194    } 
    193195 
     196    protected function escJsStr($str) { 
     197        return '\''.str_replace(array("'","\n"),array("\\'", "\\n"), $str).'\''; 
     198    } 
     199 
    194200    protected function commonJs($ctrl) { 
    195201        if($ctrl->help){ 
    196             $this->jsContent .="jForms.tControl.help='".str_replace("'","\\'",$ctrl->help)."';\n"; 
     202            $this->jsContent .="c.help=".$this->escJsStr($ctrl->help).";\n"; 
    197203        } 
    198204 
    199205        if($ctrl->required){ 
    200             $this->jsContent .="jForms.tControl.required = true;\n"; 
     206            $this->jsContent .="c.required = true;\n"; 
    201207            if($ctrl->alertRequired){ 
    202                 $this->jsContent .="jForms.tControl.errRequired='".str_replace("'","\\'",$ctrl->alertRequired)."';\n"; 
     208                $this->jsContent .="c.errRequired=".$this->escJsStr($ctrl->alertRequired).";\n"; 
    203209            } 
    204210            else { 
    205                 $this->jsContent .="jForms.tControl.errRequired='".str_replace("'","\\'",jLocale::get('jelix~formserr.js.err.required', $ctrl->label))."';\n"; 
     211                $this->jsContent .="c.errRequired=".$this->escJsStr(jLocale::get('jelix~formserr.js.err.required', $ctrl->label)).";\n"; 
    206212            } 
    207213        } 
    208214 
    209215        if($ctrl->alertInvalid){ 
    210             $this->jsContent .="jForms.tControl.errInvalid='".str_replace("'","\\'",$ctrl->alertInvalid)."';\n"; 
     216            $this->jsContent .="c.errInvalid=".$this->escJsStr($ctrl->alertInvalid).";\n"; 
    211217        } 
    212218        else { 
    213             $this->jsContent .="jForms.tControl.errInvalid='".str_replace("'","\\'",jLocale::get('jelix~formserr.js.err.invalid', $ctrl->label))."';\n"; 
    214         } 
    215  
    216         if ($this->isRootControl) $this->jsContent .="jForms.tForm.addControl(jForms.tControl);\n"; 
     219            $this->jsContent .="c.errInvalid=".$this->escJsStr(jLocale::get('jelix~formserr.js.err.invalid', $ctrl->label)).";\n"; 
     220        } 
     221 
     222        if ($this->isRootControl) $this->jsContent .="jForms.tForm.addControl(c);\n"; 
    217223    } 
    218224 
     
    245251            $dt = 'String'; 
    246252 
    247         $this->jsContent .="jForms.tControl = new jFormsControl".$dt."('".$ctrl->ref."', '".str_replace("'","\'",$ctrl->label)."');\n"; 
     253        $this->jsContent .="c = new jFormsControl".$dt."('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n"; 
    248254        if ($isLocale) 
    249             $this->jsContent .="jForms.tControl.lang='".$GLOBALS['gJConfig']->locale."';\n"; 
     255            $this->jsContent .="c.lang='".$GLOBALS['gJConfig']->locale."';\n"; 
    250256 
    251257        $maxl= $ctrl->datatype->getFacet('maxLength'); 
    252258        if($maxl !== null) 
    253             $this->jsContent .="jForms.tControl.maxLength = '$maxl';\n"; 
     259            $this->jsContent .="c.maxLength = '$maxl';\n"; 
    254260 
    255261        $minl= $ctrl->datatype->getFacet('minLength'); 
    256262        if($minl !== null) 
    257             $this->jsContent .="jForms.tControl.minLength = '$minl';\n"; 
     263            $this->jsContent .="c.minLength = '$minl';\n"; 
    258264 
    259265        $this->commonJs($ctrl); 
     
    273279    protected function jsCheckbox($ctrl) { 
    274280 
    275         $this->jsContent .="jForms.tControl = new jFormsControlBoolean('".$ctrl->ref."', '".str_replace("'","\'",$ctrl->label)."');\n"; 
     281        $this->jsContent .="c = new jFormsControlBoolean('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n"; 
    276282 
    277283        $this->commonJs($ctrl); 
     
    309315    protected function jsCheckboxes($ctrl) { 
    310316 
    311         $this->jsContent .="jForms.tControl = new jFormsControlString('".$ctrl->ref."[]', '".str_replace("'","\'",$ctrl->label)."');\n"; 
     317        $this->jsContent .="c = new jFormsControlString('".$ctrl->ref."[]', ".$this->escJsStr($ctrl->label).");\n"; 
    312318 
    313319        $this->commonJs($ctrl); 
     
    334340    protected function jsRadiobuttons($ctrl) { 
    335341 
    336         $this->jsContent .="jForms.tControl = new jFormsControlString('".$ctrl->ref."', '".str_replace("'","\'",$ctrl->label)."');\n"; 
     342        $this->jsContent .="c = new jFormsControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n"; 
    337343 
    338344        $this->commonJs($ctrl); 
     
    359365    protected function jsMenulist($ctrl) { 
    360366 
    361         $this->jsContent .="jForms.tControl = new jFormsControlString('".$ctrl->ref."', '".str_replace("'","\'",$ctrl->label)."');\n"; 
     367        $this->jsContent .="c = new jFormsControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n"; 
    362368 
    363369        $this->commonJs($ctrl); 
     
    402408    protected function jsListbox($ctrl) { 
    403409        if($ctrl->multiple){ 
    404             $this->jsContent .= "jForms.tControl = new jFormsControlString('".$ctrl->ref."[]', '".str_replace("'","\'",$ctrl->label)."');\n"; 
    405             $this->jsContent .= "jForms.tControl.multiple = true;\n"; 
     410            $this->jsContent .= "c = new jFormsControlString('".$ctrl->ref."[]', ".$this->escJsStr($ctrl->label).");\n"; 
     411            $this->jsContent .= "c.multiple = true;\n"; 
    406412        } else { 
    407             $this->jsContent .="jForms.tControl = new jFormsControlString('".$ctrl->ref."', '".str_replace("'","\'",$ctrl->label)."');\n"; 
     413            $this->jsContent .="c = new jFormsControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n"; 
    408414        } 
    409415 
     
    418424 
    419425    protected function jsTextarea($ctrl) { 
    420         $this->jsContent .="jForms.tControl = new jFormsControlString('".$ctrl->ref."', '".str_replace("'","\'",$ctrl->label)."');\n"; 
     426        $this->jsContent .="c = new jFormsControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n"; 
    421427 
    422428        $maxl= $ctrl->datatype->getFacet('maxLength'); 
    423429        if($maxl !== null) 
    424             $this->jsContent .="jForms.tControl.maxLength = '$maxl';\n"; 
     430            $this->jsContent .="c.maxLength = '$maxl';\n"; 
    425431 
    426432        $minl= $ctrl->datatype->getFacet('minLength'); 
    427433        if($minl !== null) 
    428             $this->jsContent .="jForms.tControl.minLength = '$minl';\n"; 
     434            $this->jsContent .="c.minLength = '$minl';\n"; 
    429435 
    430436        $this->commonJs($ctrl); 
     
    464470    protected function jsSecretconfirm($ctrl) { 
    465471        // we assume that a secret confirm control is just after a secret control in the list of controls 
    466         $this->jsContent .= "jForms.tControl.confirmField = new jFormsControlSecretConfirm('".$ctrl->ref."_confirm', '".str_replace("'","\\'",$ctrl->label)."');\n"; 
     472        $this->jsContent .= "c.confirmField = new jFormsControlSecretConfirm('".$ctrl->ref."_confirm', ".$this->escJsStr($ctrl->label).");\n"; 
    467473    } 
    468474 
     
    485491 
    486492    protected function jsUpload($ctrl) { 
    487         $this->jsContent .="jForms.tControl = new jFormsControlString('".$ctrl->ref."', '".str_replace("'","\'",$ctrl->label)."');\n"; 
     493        $this->jsContent .="c = new jFormsControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n"; 
    488494 
    489495        $this->commonJs($ctrl); 
     
    557563        $id=' name="'.$ctrl->ref.'" id="'.$this->_name.'_'.$ctrl->ref.'_'; 
    558564        $this->jsChoiceInternal($ctrl); 
    559         $this->jsContent .="jForms.tControl2 = jForms.tControl;\n"; 
     565        $this->jsContent .="c2 = c;\n"; 
    560566        $this->isRootControl = false; 
    561567        foreach( $ctrl->items as $itemName=>$listctrl){ 
     
    579585                if($ro) $c->setReadOnly(true); 
    580586                echo "</span>\n"; 
    581                 $this->jsContent .="jForms.tControl2.addControl(jForms.tControl, '".str_replace("'","\\'",$itemName)."');\n"; 
     587                $this->jsContent .="c2.addControl(c, ".$this->escJsStr($itemName).");\n"; 
    582588            } 
    583589            if(!$displayedControls) { 
    584                 $this->jsContent .="jForms.tControl2.items['".str_replace("'","\\'",$itemName)."']=[];\n"; 
     590                $this->jsContent .="c2.items[".$this->escJsStr($itemName)."]=[];\n"; 
    585591            } 
    586592 
     
    600606                $value=''; 
    601607        } 
    602         $this->jsContent .= "jForms.tControl2.activate('".$value."');\n"; 
     608        $this->jsContent .= "c2.activate('".$value."');\n"; 
    603609    } 
    604610 
    605611    protected function jsChoiceInternal($ctrl) { 
    606612 
    607         $this->jsContent .="jForms.tControl = new jFormsControlChoice('".$ctrl->ref."', '".str_replace("'","\'",$ctrl->label)."');\n"; 
     613        $this->jsContent .="c = new jFormsControlChoice('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n"; 
    608614 
    609615        $this->commonJs($ctrl); 
  • trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php

    r1063 r1069  
    8181        $this->assertEqualOrDiff('<script type="text/javascript"> 
    8282//<![CDATA[ 
    83  
     83(function(){var c, c2; 
     84 
     85})(); 
    8486//]]> 
    8587</script></form>', $out); 
     
    9698        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    9799        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" value=""/>', $out); 
    98         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'input1\', \'Votre nom\'); 
    99 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    100 jForms.tForm.addControl(jForms.tControl); 
     100        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     101c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     102jForms.tForm.addControl(c); 
    101103', $this->builder->getJsContent()); 
    102104 
     
    104106        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    105107        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" value="toto"/>', $out); 
    106         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'input1\', \'Votre nom\'); 
    107 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    108 jForms.tForm.addControl(jForms.tControl); 
     108        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     109c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     110jForms.tForm.addControl(c); 
    109111', $this->builder->getJsContent()); 
    110112 
     
    112114        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    113115        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" value="toto"/>', $out); 
    114         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'input1\', \'Votre nom\'); 
    115 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    116 jForms.tForm.addControl(jForms.tControl); 
     116        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     117c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     118jForms.tForm.addControl(c); 
    117119', $this->builder->getJsContent()); 
    118120 
     
    121123        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    122124        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" value="laurent"/>', $out); 
    123         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'input1\', \'Votre nom\'); 
    124 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    125 jForms.tForm.addControl(jForms.tControl); 
     125        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     126c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     127jForms.tForm.addControl(c); 
    126128', $this->builder->getJsContent()); 
    127129 
     
    129131        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    130132        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" class=" jforms-required" value="laurent"/>', $out); 
    131         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'input1\', \'Votre nom\'); 
    132 jForms.tControl.required = true; 
    133 jForms.tControl.errRequired=\'La saisie de "Votre nom" est obligatoire\'; 
    134 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    135 jForms.tForm.addControl(jForms.tControl); 
     133        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     134c.required = true; 
     135c.errRequired=\'La saisie de "Votre nom" est obligatoire\'; 
     136c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     137jForms.tForm.addControl(c); 
    136138', $this->builder->getJsContent()); 
    137139 
     
    141143        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    142144        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" readonly="readonly" class=" jforms-readonly" value="laurent"/>', $out); 
    143         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'input1\', \'Votre nom\'); 
    144 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    145 jForms.tForm.addControl(jForms.tControl); 
     145        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     146c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     147jForms.tForm.addControl(c); 
    146148', $this->builder->getJsContent()); 
    147149 
     
    151153        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    152154        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" value="laurent"/><span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->formname.'\',\'input1\')">?</a></span>', $out); 
    153         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'input1\', \'Votre nom\'); 
    154 jForms.tControl.help=\'some help\'; 
    155 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    156 jForms.tForm.addControl(jForms.tControl); 
    157 ', $this->builder->getJsContent()); 
    158  
     155        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     156c.help=\'some help\'; 
     157c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     158jForms.tForm.addControl(c); 
     159', $this->builder->getJsContent()); 
     160 
     161 
     162        $ctrl->help='some  
     163help with \' and 
     164line break.'; 
     165        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     166        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" value="laurent"/><span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->formname.'\',\'input1\')">?</a></span>', $out); 
     167        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     168c.help=\'some \nhelp with \\\' and\nline break.\'; 
     169c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     170jForms.tForm.addControl(c); 
     171', $this->builder->getJsContent()); 
    159172 
    160173        $ctrl->hint='ceci est un tooltip'; 
     174        $ctrl->help='some help'; 
    161175        ob_start();$this->builder->outputControlLabel($ctrl);$out = ob_get_clean(); 
    162176        $this->assertEqualOrDiff('<label class="jforms-label" for="'.$this->formname.'_input1" title="ceci est un tooltip">Votre nom</label>', $out); 
     
    164178        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    165179        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" title="ceci est un tooltip" value="laurent"/><span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->formname.'\',\'input1\')">?</a></span>', $out); 
    166         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'input1\', \'Votre nom\'); 
    167 jForms.tControl.help=\'some help\'; 
    168 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    169 jForms.tForm.addControl(jForms.tControl); 
     180        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     181c.help=\'some help\'; 
     182c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     183jForms.tForm.addControl(c); 
    170184', $this->builder->getJsContent()); 
    171185 
     
    176190        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    177191        $this->assertEqualOrDiff('<input type="text" name="input1" id="'.$this->formname.'_input1" maxlength="5" value="laurent"/>', $out); 
    178         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'input1\', \'Votre nom\'); 
    179 jForms.tControl.maxLength = \'5\'; 
    180 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    181 jForms.tForm.addControl(jForms.tControl); 
     192        $this->assertEqualOrDiff('c = new jFormsControlString(\'input1\', \'Votre nom\'); 
     193c.maxLength = \'5\'; 
     194c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     195jForms.tForm.addControl(c); 
    182196', $this->builder->getJsContent()); 
    183197 
     
    194208        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    195209        $this->assertEqualOrDiff('<input type="checkbox" name="chk1" id="'.$this->formname.'_chk1" value="1"/>', $out); 
    196         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlBoolean(\'chk1\', \'Une option\'); 
    197 jForms.tControl.errInvalid=\'La saisie de "Une option" est invalide\'; 
    198 jForms.tForm.addControl(jForms.tControl); 
     210        $this->assertEqualOrDiff('c = new jFormsControlBoolean(\'chk1\', \'Une option\'); 
     211c.errInvalid=\'La saisie de "Une option" est invalide\'; 
     212jForms.tForm.addControl(c); 
    199213', $this->builder->getJsContent()); 
    200214 
     
    203217        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    204218        $this->assertEqualOrDiff('<input type="checkbox" name="chk1" id="'.$this->formname.'_chk1" checked="checked" value="1"/>', $out); 
    205         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlBoolean(\'chk1\', \'Une option\'); 
    206 jForms.tControl.errInvalid=\'La saisie de "Une option" est invalide\'; 
    207 jForms.tForm.addControl(jForms.tControl); 
     219        $this->assertEqualOrDiff('c = new jFormsControlBoolean(\'chk1\', \'Une option\'); 
     220c.errInvalid=\'La saisie de "Une option" est invalide\'; 
     221jForms.tForm.addControl(c); 
    208222', $this->builder->getJsContent()); 
    209223 
     
    218232        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    219233        $this->assertEqualOrDiff('<input type="checkbox" name="chk2" id="'.$this->formname.'_chk2" value="1"/>', $out); 
    220         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
    221 jForms.tControl.errInvalid=\'La saisie de "Une option" est invalide\'; 
    222 jForms.tForm.addControl(jForms.tControl); 
     234        $this->assertEqualOrDiff('c = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
     235c.errInvalid=\'La saisie de "Une option" est invalide\'; 
     236jForms.tForm.addControl(c); 
    223237', $this->builder->getJsContent()); 
    224238 
     
    229243        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    230244        $this->assertEqualOrDiff('<input type="checkbox" name="chk2" id="'.$this->formname.'_chk2" checked="checked" value="1"/>', $out); 
    231         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
    232 jForms.tControl.errInvalid=\'La saisie de "Une option" est invalide\'; 
    233 jForms.tForm.addControl(jForms.tControl); 
     245        $this->assertEqualOrDiff('c = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
     246c.errInvalid=\'La saisie de "Une option" est invalide\'; 
     247jForms.tForm.addControl(c); 
    234248', $this->builder->getJsContent()); 
    235249 
     
    237251        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    238252        $this->assertEqualOrDiff('<input type="checkbox" name="chk2" id="'.$this->formname.'_chk2" value="1"/>', $out); 
    239         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
    240 jForms.tControl.errInvalid=\'La saisie de "Une option" est invalide\'; 
    241 jForms.tForm.addControl(jForms.tControl); 
     253        $this->assertEqualOrDiff('c = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
     254c.errInvalid=\'La saisie de "Une option" est invalide\'; 
     255jForms.tForm.addControl(c); 
    242256', $this->builder->getJsContent()); 
    243257 
     
    246260        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    247261        $this->assertEqualOrDiff('<input type="checkbox" name="chk2" id="'.$this->formname.'_chk2" readonly="readonly" class=" jforms-readonly" value="1"/>', $out); 
    248         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
    249 jForms.tControl.errInvalid=\'La saisie de "Une option" est invalide\'; 
    250 jForms.tForm.addControl(jForms.tControl); 
     262        $this->assertEqualOrDiff('c = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
     263c.errInvalid=\'La saisie de "Une option" est invalide\'; 
     264jForms.tForm.addControl(c); 
    251265', $this->builder->getJsContent()); 
    252266 
     
    255269        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    256270        $this->assertEqualOrDiff('<input type="checkbox" name="chk2" id="'.$this->formname.'_chk2" readonly="readonly" class=" jforms-readonly" checked="checked" value="1"/>', $out); 
    257         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
    258 jForms.tControl.errInvalid=\'La saisie de "Une option" est invalide\'; 
    259 jForms.tForm.addControl(jForms.tControl); 
     271        $this->assertEqualOrDiff('c = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
     272c.errInvalid=\'La saisie de "Une option" est invalide\'; 
     273jForms.tForm.addControl(c); 
    260274', $this->builder->getJsContent()); 
    261275 
     
    266280        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    267281        $this->assertEqualOrDiff('<input type="checkbox" name="chk2" id="'.$this->formname.'_chk2" readonly="readonly" title="ceci est un tooltip" class=" jforms-readonly" checked="checked" value="1"/>', $out); 
    268         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
    269 jForms.tControl.errInvalid=\'La saisie de "Une option" est invalide\'; 
    270 jForms.tForm.addControl(jForms.tControl); 
     282        $this->assertEqualOrDiff('c = new jFormsControlBoolean(\'chk2\', \'Une option\'); 
     283c.errInvalid=\'La saisie de "Une option" est invalide\'; 
     284jForms.tForm.addControl(c); 
    271285', $this->builder->getJsContent()); 
    272286 
     
    295309        $result.='<span class="jforms-chkbox jforms-ctl-choixsimple"><input type="checkbox" name="choixsimple[]" id="'.$this->formname.'_choixsimple_2" value="23"/><label for="'.$this->formname.'_choixsimple_2">baz</label></span>'; 
    296310        $this->assertEqualOrDiff($result, $out); 
    297         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'choixsimple[]\', \'Vos choix\'); 
    298 jForms.tControl.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
    299 jForms.tForm.addControl(jForms.tControl); 
     311        $this->assertEqualOrDiff('c = new jFormsControlString(\'choixsimple[]\', \'Vos choix\'); 
     312c.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
     313jForms.tForm.addControl(c); 
    300314', $this->builder->getJsContent()); 
    301315 
     
    307321        $result.='<span class="jforms-chkbox jforms-ctl-choixsimple"><input type="checkbox" name="choixsimple[]" id="'.$this->formname.'_choixsimple_2" value="23"/><label for="'.$this->formname.'_choixsimple_2">baz</label></span>'; 
    308322        $this->assertEqualOrDiff($result, $out); 
    309         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'choixsimple[]\', \'Vos choix\'); 
    310 jForms.tControl.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
    311 jForms.tForm.addControl(jForms.tControl); 
     323        $this->assertEqualOrDiff('c = new jFormsControlString(\'choixsimple[]\', \'Vos choix\'); 
     324c.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
     325jForms.tForm.addControl(c); 
    312326', $this->builder->getJsContent()); 
    313327 
     
    332346        $result.='<span class="jforms-chkbox jforms-ctl-choixmultiple"><input type="checkbox" name="choixmultiple[]" id="'.$this->formname.'_choixmultiple_2" value="23"/><label for="'.$this->formname.'_choixmultiple_2">baz</label></span>'; 
    333347        $this->assertEqualOrDiff($result, $out); 
    334         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'choixmultiple[]\', \'Vos choix\'); 
    335 jForms.tControl.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
    336 jForms.tForm.addControl(jForms.tControl); 
     348        $this->assertEqualOrDiff('c = new jFormsControlString(\'choixmultiple[]\', \'Vos choix\'); 
     349c.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
     350jForms.tForm.addControl(c); 
    337351', $this->builder->getJsContent()); 
    338352 
     
    344358        $result.='<span class="jforms-chkbox jforms-ctl-choixmultiple"><input type="checkbox" name="choixmultiple[]" id="'.$this->formname.'_choixmultiple_2" value="23"/><label for="'.$this->formname.'_choixmultiple_2">baz</label></span>'; 
    345359        $this->assertEqualOrDiff($result, $out); 
    346         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'choixmultiple[]\', \'Vos choix\'); 
    347 jForms.tControl.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
    348 jForms.tForm.addControl(jForms.tControl); 
     360        $this->assertEqualOrDiff('c = new jFormsControlString(\'choixmultiple[]\', \'Vos choix\'); 
     361c.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
     362jForms.tForm.addControl(c); 
    349363', $this->builder->getJsContent()); 
    350364 
     
    356370        $result.='<span class="jforms-chkbox jforms-ctl-choixmultiple"><input type="checkbox" name="choixmultiple[]" id="'.$this->formname.'_choixmultiple_2" value="23" checked="checked"/><label for="'.$this->formname.'_choixmultiple_2">baz</label></span>'; 
    357371        $this->assertEqualOrDiff($result, $out); 
    358         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'choixmultiple[]\', \'Vos choix\'); 
    359 jForms.tControl.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
    360 jForms.tForm.addControl(jForms.tControl); 
     372        $this->assertEqualOrDiff('c = new jFormsControlString(\'choixmultiple[]\', \'Vos choix\'); 
     373c.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
     374jForms.tForm.addControl(c); 
    361375', $this->builder->getJsContent()); 
    362376 
     
    372386        $result.='<span class="jforms-chkbox jforms-ctl-choixmultiple"><input type="checkbox" name="choixmultiple[]" id="'.$this->formname.'_choixmultiple_2" value="23" checked="checked" readonly="readonly" class=" jforms-readonly"/><label for="'.$this->formname.'_choixmultiple_2">baz</label></span>'; 
    373387        $this->assertEqualOrDiff($result, $out); 
    374         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'choixmultiple[]\', \'Vos choix\'); 
    375 jForms.tControl.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
    376 jForms.tForm.addControl(jForms.tControl); 
     388        $this->assertEqualOrDiff('c = new jFormsControlString(\'choixmultiple[]\', \'Vos choix\'); 
     389c.errInvalid=\'La saisie de "Vos choix" est invalide\'; 
     390jForms.tForm.addControl(c); 
    377391', $this->builder->getJsContent()); 
    378392    } 
     
    393407        $result.='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_2" value="23"/><label for="'.$this->formname.'_rbchoixsimple_2">baz</label></span>'; 
    394408        $this->assertEqualOrDiff($result, $out); 
    395         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
    396 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    397 jForms.tForm.addControl(jForms.tControl); 
     409        $this->assertEqualOrDiff('c = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
     410c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     411jForms.tForm.addControl(c); 
    398412', $this->builder->getJsContent()); 
    399413 
     
    406420        $result.='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_2" value="23"/><label for="'.$this->formname.'_rbchoixsimple_2">baz</label></span>'; 
    407421        $this->assertEqualOrDiff($result, $out); 
    408         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
    409 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    410 jForms.tForm.addControl(jForms.tControl); 
     422        $this->assertEqualOrDiff('c = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
     423c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     424jForms.tForm.addControl(c); 
    411425', $this->builder->getJsContent()); 
    412426 
     
    424438        $result.='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_2" value="23"/><label for="'.$this->formname.'_rbchoixsimple_2">baz</label></span>'; 
    425439        $this->assertEqualOrDiff($result, $out); 
    426         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
    427 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    428 jForms.tForm.addControl(jForms.tControl); 
     440        $this->assertEqualOrDiff('c = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
     441c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     442jForms.tForm.addControl(c); 
    429443', $this->builder->getJsContent()); 
    430444 
     
    436450        $result.='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_2" value="23" checked="checked"/><label for="'.$this->formname.'_rbchoixsimple_2">baz</label></span>'; 
    437451        $this->assertEqualOrDiff($result, $out); 
    438         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
    439 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    440 jForms.tForm.addControl(jForms.tControl); 
     452        $this->assertEqualOrDiff('c = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
     453c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     454jForms.tForm.addControl(c); 
    441455', $this->builder->getJsContent()); 
    442456 
     
    451465        $result.='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_2" value="23" checked="checked" readonly="readonly" class=" jforms-readonly"/><label for="'.$this->formname.'_rbchoixsimple_2">baz</label></span>'; 
    452466        $this->assertEqualOrDiff($result, $out); 
    453         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
    454 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    455 jForms.tForm.addControl(jForms.tControl); 
     467        $this->assertEqualOrDiff('c = new jFormsControlString(\'rbchoixsimple\', \'Votre choix\'); 
     468c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     469jForms.tForm.addControl(c); 
    456470', $this->builder->getJsContent()); 
    457471 
     
    476490        $result.='</select>'; 
    477491        $this->assertEqualOrDiff($result, $out); 
    478         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    479 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    480 jForms.tForm.addControl(jForms.tControl); 
     492        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     493c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     494jForms.tForm.addControl(c); 
    481495', $this->builder->getJsContent()); 
    482496 
     
    491505        $result.='</select>'; 
    492506        $this->assertEqualOrDiff($result, $out); 
    493         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    494 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    495 jForms.tForm.addControl(jForms.tControl); 
     507        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     508c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     509jForms.tForm.addControl(c); 
    496510', $this->builder->getJsContent()); 
    497511 
     
    506520        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    507521        $this->assertEqualOrDiff($result, $out); 
    508         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    509 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    510 jForms.tForm.addControl(jForms.tControl); 
     522        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     523c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     524jForms.tForm.addControl(c); 
    511525', $this->builder->getJsContent()); 
    512526 
     
    524538        $result.='</select>'; 
    525539        $this->assertEqualOrDiff($result, $out); 
    526         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    527 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    528 jForms.tForm.addControl(jForms.tControl); 
     540        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     541c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     542jForms.tForm.addControl(c); 
    529543', $this->builder->getJsContent()); 
    530544 
     
    539553        $result.='</select>'; 
    540554        $this->assertEqualOrDiff($result, $out); 
    541         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    542 jForms.tControl.required = true; 
    543 jForms.tControl.errRequired=\'La saisie de "Votre choix" est obligatoire\'; 
    544 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    545 jForms.tForm.addControl(jForms.tControl); 
     555        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     556c.required = true; 
     557c.errRequired=\'La saisie de "Votre choix" est obligatoire\'; 
     558c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     559jForms.tForm.addControl(c); 
    546560', $this->builder->getJsContent()); 
    547561 
     
    557571        $result.='</select>'; 
    558572        $this->assertEqualOrDiff($result, $out); 
    559         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    560 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    561 jForms.tForm.addControl(jForms.tControl); 
     573        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     574c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     575jForms.tForm.addControl(c); 
    562576', $this->builder->getJsContent()); 
    563577 
     
    573587        $result.='</select>'; 
    574588        $this->assertEqualOrDiff($result, $out); 
    575         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    576 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    577 jForms.tForm.addControl(jForms.tControl); 
     589        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     590c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     591jForms.tForm.addControl(c); 
    578592', $this->builder->getJsContent()); 
    579593 
     
    586600        $result.='</select>'; 
    587601        $this->assertEqualOrDiff($result, $out); 
    588         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    589 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    590 jForms.tForm.addControl(jForms.tControl); 
     602        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     603c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     604jForms.tForm.addControl(c); 
    591605', $this->builder->getJsContent()); 
    592606 
     
    599613        $result.='</select>'; 
    600614        $this->assertEqualOrDiff($result, $out); 
    601         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    602 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    603 jForms.tForm.addControl(jForms.tControl); 
     615        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     616c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     617jForms.tForm.addControl(c); 
    604618', $this->builder->getJsContent()); 
    605619 
     
    618632        $result.='</select>'; 
    619633        $this->assertEqualOrDiff($result, $out); 
    620         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
    621 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    622 jForms.tForm.addControl(jForms.tControl); 
     634        $this->assertEqualOrDiff('c = new jFormsControlString(\'menulist1\', \'Votre choix\'); 
     635c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     636jForms.tForm.addControl(c); 
    623637', $this->builder->getJsContent()); 
    624638 
     
    730744        $result.='</select>'; 
    731745        $this->assertEqualOrDiff($result, $out); 
    732         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'listbox1\', \'Votre choix\'); 
    733 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    734 jForms.tForm.addControl(jForms.tControl); 
     746        $this->assertEqualOrDiff('c = new jFormsControlString(\'listbox1\', \'Votre choix\'); 
     747c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     748jForms.tForm.addControl(c); 
    735749', $this->builder->getJsContent()); 
    736750 
     
    743757        $result.='</select>'; 
    744758        $this->assertEqualOrDiff($result, $out); 
    745         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'listbox1\', \'Votre choix\'); 
    746 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    747 jForms.tForm.addControl(jForms.tControl); 
     759        $this->assertEqualOrDiff('c = new jFormsControlString(\'listbox1\', \'Votre choix\'); 
     760c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     761jForms.tForm.addControl(c); 
    748762', $this->builder->getJsContent()); 
    749763 
     
    758772        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    759773        $this->assertEqualOrDiff($result, $out); 
    760         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'listbox1\', \'Votre choix\'); 
    761 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    762 jForms.tForm.addControl(jForms.tControl); 
     774        $this->assertEqualOrDiff('c = new jFormsControlString(\'listbox1\', \'Votre choix\'); 
     775c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     776jForms.tForm.addControl(c); 
    763777', $this->builder->getJsContent()); 
    764778 
     
    775789        $result.='</select>'; 
    776790        $this->assertEqualOrDiff($result, $out); 
    777         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'listbox1\', \'Votre choix\'); 
    778 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    779 jForms.tForm.addControl(jForms.tControl); 
     791        $this->assertEqualOrDiff('c = new jFormsControlString(\'listbox1\', \'Votre choix\'); 
     792c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     793jForms.tForm.addControl(c); 
    780794', $this->builder->getJsContent()); 
    781795 
     
    800814        $result.='</select>'; 
    801815        $this->assertEqualOrDiff($result, $out); 
    802         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'lbchoixmultiple[]\', \'Votre choix\'); 
    803 jForms.tControl.multiple = true; 
    804 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    805 jForms.tForm.addControl(jForms.tControl); 
     816        $this->assertEqualOrDiff('c = new jFormsControlString(\'lbchoixmultiple[]\', \'Votre choix\'); 
     817c.multiple = true; 
     818c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     819jForms.tForm.addControl(c); 
    806820', $this->builder->getJsContent()); 
    807821 
     
    815829        $result.='</select>'; 
    816830        $this->assertEqualOrDiff($result, $out); 
    817         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'lbchoixmultiple[]\', \'Votre choix\'); 
    818 jForms.tControl.multiple = true; 
    819 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    820 jForms.tForm.addControl(jForms.tControl); 
     831        $this->assertEqualOrDiff('c = new jFormsControlString(\'lbchoixmultiple[]\', \'Votre choix\'); 
     832c.multiple = true; 
     833c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     834jForms.tForm.addControl(c); 
    821835', $this->builder->getJsContent()); 
    822836 
     
    839853        $result.='</select>'; 
    840854        $this->assertEqualOrDiff($result, $out); 
    841         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'listbox2\', \'Votre choix\'); 
    842 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    843 jForms.tForm.addControl(jForms.tControl); 
     855        $this->assertEqualOrDiff('c = new jFormsControlString(\'listbox2\', \'Votre choix\'); 
     856c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     857jForms.tForm.addControl(c); 
    844858', $this->builder->getJsContent()); 
    845859 
     
    864878        $result.='</select>'; 
    865879        $this->assertEqualOrDiff($result, $out); 
    866         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'lbchoixmultiple2[]\', \'Votre choix\'); 
    867 jForms.tControl.multiple = true; 
    868 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    869 jForms.tForm.addControl(jForms.tControl); 
     880        $this->assertEqualOrDiff('c = new jFormsControlString(\'lbchoixmultiple2[]\', \'Votre choix\'); 
     881c.multiple = true; 
     882c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     883jForms.tForm.addControl(c); 
    870884', $this->builder->getJsContent()); 
    871885 
     
    888902        $result.='</select>'; 
    889903        $this->assertEqualOrDiff($result, $out); 
    890         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'listboxclass\', \'Votre choix\'); 
    891 jForms.tControl.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
    892 jForms.tForm.addControl(jForms.tControl); 
     904        $this->assertEqualOrDiff('c = new jFormsControlString(\'listboxclass\', \'Votre choix\'); 
     905c.errInvalid=\'La saisie de "Votre choix" est invalide\'; 
     906jForms.tForm.addControl(c); 
    893907', $this->builder->getJsContent()); 
    894908 
     
    907921        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    908922        $this->assertEqualOrDiff('<textarea name="textarea1" id="'.$this->formname.'_textarea1" rows="5" cols="40"></textarea>', $out); 
    909         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'textarea1\', \'Votre nom\'); 
    910 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    911 jForms.tForm.addControl(jForms.tControl); 
     923        $this->assertEqualOrDiff('c = new jFormsControlString(\'textarea1\', \'Votre nom\'); 
     924c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     925jForms.tForm.addControl(c); 
    912926', $this->builder->getJsContent()); 
    913927 
     
    916930        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    917931        $this->assertEqualOrDiff('<textarea name="textarea1" id="'.$this->formname.'_textarea1" rows="5" cols="40">laurent</textarea>', $out); 
    918         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'textarea1\', \'Votre nom\'); 
    919 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    920 jForms.tForm.addControl(jForms.tControl); 
     932        $this->assertEqualOrDiff('c = new jFormsControlString(\'textarea1\', \'Votre nom\'); 
     933c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     934jForms.tForm.addControl(c); 
    921935', $this->builder->getJsContent()); 
    922936 
     
    925939        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    926940        $this->assertEqualOrDiff('<textarea name="textarea1" id="'.$this->formname.'_textarea1" readonly="readonly" class=" jforms-readonly" rows="5" cols="40">laurent</textarea>', $out); 
    927         $this->assertEqualOrDiff('jForms.tControl = new jFormsControlString(\'textarea1\', \'Votre nom\'); 
    928 jForms.tControl.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
    929 jForms.tForm.addControl(jForms.tControl); 
     941        $this->assertEqualOrDiff('c = new jFormsControlString(\'textarea1\', \'Votre nom\'); 
     942c.errInvalid=\'La saisie de "Votre nom" est invalide\'; 
     943jForms.tForm.addControl(c); 
    930944', $this->builder->getJsContent()); 
    931945 
     
    937951        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
    938952        $this->assertEqualOrDiff('<te