Fixes required: false being treated as true

Fixes #2712
This commit is contained in:
Samuel Georges 2017-04-05 22:24:00 +10:00
parent 9f809becca
commit b858ff680e
2 changed files with 3 additions and 3 deletions

View File

@ -54,12 +54,12 @@
if ((this.options.required !== undefined ||
this.options.validationPattern !== undefined ||
this.options.validationMessage !== undefined) &&
this.options.validationMessage !== undefined) &&
this.options.validation !== undefined) {
this.throwError('Legacy and new validation syntax should not be mixed.')
}
if (this.options.required !== undefined) {
if (this.options.required !== undefined && this.options.required) {
var validator = new $.oc.inspector.validators.required({
message: this.options.validationMessage
})

View File

@ -6314,7 +6314,7 @@ BaseProto.dispose.call(this)}
ValidationSet.prototype.disposeValidators=function(){for(var i=0,len=this.validators.length;i<len;i++){this.validators[i].dispose()}}
ValidationSet.prototype.throwError=function(errorMessage){throw new Error(errorMessage+' Property: '+this.propertyName)}
ValidationSet.prototype.createValidators=function(){if((this.options.required!==undefined||this.options.validationPattern!==undefined||this.options.validationMessage!==undefined)&&this.options.validation!==undefined){this.throwError('Legacy and new validation syntax should not be mixed.')}
if(this.options.required!==undefined){var validator=new $.oc.inspector.validators.required({message:this.options.validationMessage})
if(this.options.required!==undefined&&this.options.required){var validator=new $.oc.inspector.validators.required({message:this.options.validationMessage})
this.validators.push(validator)}
if(this.options.validationPattern!==undefined){var validator=new $.oc.inspector.validators.regex({message:this.options.validationMessage,pattern:this.options.validationPattern})
this.validators.push(validator)}