留言板
Custom Aui validator makes input required
Ricardo Vieira,修改在6 年前。
Custom Aui validator makes input required
New Member 帖子: 6 加入日期: 17-1-16 最近的帖子
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,修改在6 年前。
RE: Custom Aui validator makes input required
New Member 帖子: 6 加入日期: 17-1-16 最近的帖子
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,修改在6 年前。
RE: Custom Aui validator makes input required
Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
What Portal version are you using?
Byran Zaugg,修改在6 年前。
RE: Custom Aui validator makes input required
Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
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,修改在6 年前。
RE: Custom Aui validator makes input required
New Member 帖子: 6 加入日期: 17-1-16 最近的帖子
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,修改在6 年前。
RE: Custom Aui validator makes input required
Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
I believe so, yes.
Ricardo Vieira,修改在6 年前。
RE: Custom Aui validator makes input required
New Member 帖子: 6 加入日期: 17-1-16 最近的帖子
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