A form can be submitted even when some elements in it do not pass validation
Modified on: Fri, 17 Nov 2023 12:07 PMOriginal Publishing Date:
2020-01-22
2020-01-22
Symptoms
A user can submit a form in Custom UI when some fields in this form are not valid.
Cause
Validation check is not added to onSubmit method
Resolution
You should call aps/PageContainer
's validate()
method to check if all fields are valid.
For example, assuming my PageContainer
has an id of 'top':
aps.app.onSubmit = function() {
var form = registry.byId("top");
if (!form.validate()){
console.log("Not all fields are valid");
aps.apsc.cancelProcessing();
return;
}
// normal processing logic below this line
}
Additional information and examples can be checked on the PageContainer documentation page.