onsubmit only if mandatory fields were filled.
Hi, I'm trying to accomplish following scenario.
On a new form I added a function, triggered by fd.onsubmit. Problem is that my form has a few SharePoint standard mandatory fields, if they are not filled the form will not be sent, but my event will trigger anyways.
Is it possible to trigger only on a successfully submitted form?
regards
On a new form I added a function, triggered by fd.onsubmit. Problem is that my form has a few SharePoint standard mandatory fields, if they are not filled the form will not be sent, but my event will trigger anyways.
Is it possible to trigger only on a successfully submitted form?
regards
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Alex,
The issue is that the check for mandatory servers happens on the server, after the JavaScript onsubmit works. Since it happens after, the only option to ensure that it works is to add code to onsubmit block that will check the mandatory fields on its own and will only work if all fields are filled in properly.
The issue is that the check for mandatory servers happens on the server, after the JavaScript onsubmit works. Since it happens after, the only option to ensure that it works is to add code to onsubmit block that will check the mandatory fields on its own and will only work if all fields are filled in properly.
Cheers
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Alex,
The best way depends on how many mandatory fields you have and what's their type. Easiest way would be to manually check all the fields by getting the data from them, but if you have a large number of fields or need to do it for many lists and need a more flexible solution, let us know. For getting data from fields, check out the following article - https://spform.com/javascript-framework ... eld-values
The best way depends on how many mandatory fields you have and what's their type. Easiest way would be to manually check all the fields by getting the data from them, but if you have a large number of fields or need to do it for many lists and need a more flexible solution, let us know. For getting data from fields, check out the following article - https://spform.com/javascript-framework ... eld-values
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 15 guests