When using server-side validation on a modal page with tabs, if the validation fails, it returns the user to the first tab in the modal, which is not necessarily the tab where the error occurred. This is confusing to users, because it appears as though the submission succeeded, since there's no visible error message. Is this the expected behavior for server side validation? Is there any way to make it automatically return the user to the tab where the error occurred? This is happening in PHPMaker v2021.0.15
Server-side validation with tabs in modal
-
- User
- Posts: 9419
By "tabs" did you mean Multi-Page? It seems that the generated code only focuses the error field after client side validation, it won't focus the field after server side validation on page load. However, you can do it yourself by Startup Script, e.g. Edit page of the "cars" table (v2021)
loadjs.ready("fcarsedit", function () { // Form is ready
$(function() { // On page load
for (let field of Object.values(fcarsedit.fields)) { // Loop through the fields
if (field.invalid) { // Field is invalid
fcarsedit.makeVisible(field.element); // Make it visible
field.focus(); // Focus it
break;
}
}
});
});