Foros de discusión
Custom Aui validator makes input required
Ricardo Vieira, modificado hace 6 años.
Custom Aui validator makes input required
New Member Mensajes: 6 Fecha de incorporación: 16/01/17 Mensajes recientes
Hi all,
Whenever I add a custom validator to an input in my form that input gets required, even if I don't have the required validator.
Example:
If i remove the custom validator, I can submit the form with an empty input, with the custom validator, if empty, I get the error message from the acceptFiles validator, does this happen to anyone?
Thanks in advance
Whenever I add a custom validator to an input in my form that input gets required, even if I don't have the required validator.
Example:
<aui:input id="upload01" name="upload01" type="file" onchange="addFile(this,'file-uploaded')" label="">
<aui:validator name="acceptFiles" errormessage="form.contacts.validator.files.type">
'bmp,doc,docx,gif,jpg,pdf,png,ppt,pptx,rtf,sxc,sxi,sxw,tiff,txt,vsd,xls,xlsx,xml,jrxml,zip,rar'
</aui:validator>
<aui:validator name="custom" errormessage="form.claim.validator.files.size">
function (val,fieldNode, ruleValue) {
if(uploadSize==true){
return true;
}else{
return false;
}
}
</aui:validator>
</aui:input>
If i remove the custom validator, I can submit the form with an empty input, with the custom validator, if empty, I get the error message from the acceptFiles validator, does this happen to anyone?
Thanks in advance
Ricardo Vieira, modificado hace 6 años.
RE: Custom Aui validator makes input required
New Member Mensajes: 6 Fecha de incorporación: 16/01/17 Mensajes recientes
Hi all,
I've just tried with just a custom validator that returns true, and when empty (i don't have the required validator) it returns the error message,
Am I doing something wrong, what is the validator suppose to return when empty ? If I remove the acceptFiles validator, the custom works without a problem when empty input.
I've just tried with just a custom validator that returns true, and when empty (i don't have the required validator) it returns the error message,
<aui:validator name="acceptFiles" errormessage="form.contacts.validator.files.type">
'bmp,doc,docx,gif,jpg,pdf,png,ppt,pptx,rtf,sxc,sxi,sxw,tiff,txt,vsd,xls,xlsx,xml,jrxml,zip,rar'
</aui:validator>
<aui:validator name="custom" errormessage="form.claim.validator.files.size">
function (val,fieldNode, ruleValue) {
return true;
}
</aui:validator>
Am I doing something wrong, what is the validator suppose to return when empty ? If I remove the acceptFiles validator, the custom works without a problem when empty input.
Byran Zaugg, modificado hace 6 años.
RE: Custom Aui validator makes input required
Expert Mensajes: 252 Fecha de incorporación: 6/04/12 Mensajes recientes
What Portal version are you using?
Byran Zaugg, modificado hace 6 años.
RE: Custom Aui validator makes input required
Expert Mensajes: 252 Fecha de incorporación: 6/04/12 Mensajes recientes
Syntax wise, it looks like you're using Form Validator correctly. See our Forms And Validation docs.
There was a breaking change in 7.0 in which custom validators are no longer implicitly required.
If you're using 6.2 or before, custom validators WILL be implicitly required. The only way around this was the breaking change in 7.0. See Why was this change made? for details.
There was a breaking change in 7.0 in which custom validators are no longer implicitly required.
If you're using 6.2 or before, custom validators WILL be implicitly required. The only way around this was the breaking change in 7.0. See Why was this change made? for details.
Ricardo Vieira, modificado hace 6 años.
RE: Custom Aui validator makes input required
New Member Mensajes: 6 Fecha de incorporación: 16/01/17 Mensajes recientes
Hi Byran
I'm using 6.2 EE, so can't move up to 7 now.
So the only way I can have a custom validator is alone, and handle the other validators inside the custom one, and handle the empty situation also right?
Ok, thank you.
I'm using 6.2 EE, so can't move up to 7 now.
So the only way I can have a custom validator is alone, and handle the other validators inside the custom one, and handle the empty situation also right?
Ok, thank you.
Byran Zaugg, modificado hace 6 años.
RE: Custom Aui validator makes input required
Expert Mensajes: 252 Fecha de incorporación: 6/04/12 Mensajes recientes
I believe so, yes.
Ricardo Vieira, modificado hace 6 años.
RE: Custom Aui validator makes input required
New Member Mensajes: 6 Fecha de incorporación: 16/01/17 Mensajes recientes
I got it working now, with just the custom validator and doing everything there, only problem is now only have one error message, so had to put a more generic one.
Thank you Byran
Thank you Byran