As it works today, if you miss to fill out a required field you will see “This field is required”. If you miss to fill in several fields you will still see “This field is required” one field at the time.
Would it be possible to show the number of fields that is required as a complement to how it is today? For example if I have not filled in any form and press Download/ Submit button, it should appear a text that says “7 fields are required”.
Thanks!
“7 fields are required” I‘d think.
You can get the number of (natively) invalid fields and do whatever you want with it:
MktoForms2.whenReady(function(mktoForm){
let formEl = mktoForm.getFormElem()[0];
mktoForm.onValidate(function(nativeValid){
if(!nativeValid){
let numInvalids = formEl.querySelectorAll(".mktoRequired.mktoInvalid").length;
// do something with numInvalids
}
});
});
With some special case coding for "1 field is required" (no s on fields and is not are)
Cheers
Jo