Changeset 1188 for trunk/lib/jelix-www

Show
Ignore:
Timestamp:
12/01/08 12:58:35 (1 month ago)
Author:
julieni
Message:

ticket #751: jForms: javascript check of secret control's confirmation does not work

Files:

Legend:

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

    r1187 r1188  
    244244 
    245245/** 
    246  * control with optional confirmation string 
     246 * control for secret input 
    247247 */ 
    248248function jFormsJQControlSecret(name, label) { 
     
    253253    this.errRequired = ''; 
    254254    this.help=''; 
    255     this.confirmField = null; 
    256255    this.minLength = -1; 
    257256    this.maxLength = -1; 
     
    262261    if(this.maxLength != -1 && val.length > this.maxLength) 
    263262        return false; 
    264  
    265     if(this.confirmField){ 
    266         var val2 = jfrm.getValue(jfrm.frmElt.elements[this.confirmField.name]); 
    267         if(val != val2){ 
    268             jfrm.tForm.errorDecorator.addError(this.confirmField, 2); 
    269             return false; 
    270         } 
    271     } 
    272263    return true; 
    273264}; 
    274 function jFormsJQControlSecretConfirm(name, label) { 
    275     this.name = name; 
    276     this.label = label; 
    277     this.errInvalid = ''; 
    278     this.errRequired = ''; 
    279     this.help=''; 
    280     this.minLength = -1; 
    281     this.maxLength = -1; 
    282 }; 
     265 
     266/** 
     267 * confirm control 
     268 */ 
     269function jFormsJQControlConfirm(name, label) { 
     270    this.name = name; 
     271    this.label = label; 
     272    this.required = false; 
     273    this.errInvalid = ''; 
     274    this.errRequired = ''; 
     275    this.help=''; 
     276    this._masterControl = name.replace(/_confirm$/,''); 
     277}; 
     278jFormsJQControlConfirm.prototype.check = function(val, jfrm) { 
     279    if(jfrm.getValue(jfrm.frmElt.elements[this._masterControl]) !== val) 
     280        return false; 
     281    return true; 
     282
    283283 
    284284/** 
  • trunk/lib/jelix-www/js/jforms_light.js

    r1187 r1188  
    257257 
    258258/** 
    259  * control with optional confirmation string 
     259 * control for secret input 
    260260 */ 
    261261function jFormsControlSecret(name, label) { 
     
    266266    this.errRequired = ''; 
    267267    this.help=''; 
    268     this.confirmField = null; 
    269268    this.minLength = -1; 
    270269    this.maxLength = -1; 
     
    275274    if(this.maxLength != -1 && val.length > this.maxLength) 
    276275        return false; 
    277  
    278     if(this.confirmField){ 
    279         var val2 = jfrm.getValue(jfrm.frmElt.elements[this.confirmField.name]); 
    280         if(val != val2){ 
    281             jfrm.tForm.errorDecorator.addError(this.confirmField, 2); 
    282             return false; 
    283         } 
    284     } 
    285276    return true; 
    286277}; 
    287 function jFormsControlSecretConfirm(name, label) { 
    288     this.name = name; 
    289     this.label = label; 
    290     this.errInvalid = ''; 
    291     this.errRequired = ''; 
    292     this.help=''; 
    293     this.minLength = -1; 
    294     this.maxLength = -1; 
    295 }; 
     278 
     279/** 
     280 * confirm control 
     281 */ 
     282function jFormsControlConfirm(name, label) { 
     283    this.name = name; 
     284    this.label = label; 
     285    this.required = false; 
     286    this.errInvalid = ''; 
     287    this.errRequired = ''; 
     288    this.help=''; 
     289    this._masterControl = name.replace(/_confirm$/,''); 
     290}; 
     291jFormsControlConfirm.prototype.check = function(val, jfrm) { 
     292    if(jfrm.getValue(jfrm.frmElt.elements[this._masterControl]) !== val) 
     293        return false; 
     294    return true; 
     295
    296296 
    297297/** 
Download in other formats: Unified Diff Zip Archive