Hello, Andrew!
There is only one way it can be done - through client-side validation, and you'll need to write it for every required field on the Form.
Here is my example code:
Code: Select all
fd.onsubmit(function(){
if(!fd.field("Title").value()){
$('#fd_tabcontrol-0').tabs('option', 'active', 0);
}
if(!fd.field("Test").value()){
$('#fd_tabcontrol-0').tabs('option', 'active', 1);
}
return true;
});
I have two required text fields - Title and Test, I also have them on two different tabs. If one of them is empty, the active tab will switch to the correct one when I try to save. I don't need to display an error message as the server validation will do it for me.
You can write similar code for your case. Few things to conside:
1)
fd_tabcontrol-0 is an ID of the Tab Control, it's counted from zero. You will need to find the correct ID if you have more than one Tab Control on the Form.
2)
tabs('option', 'active', 0) switches an active tab to a different one, but it is also counted from 0.
3) Different fields on your Form will likely need different methods to get their value, if you want to check if they are empty or not. Try to experiment with fields, you can add
alert(fd.field("Field").value()); calls to the code to see what values are being returned by the fields that do not get checked normally. Finally, this documentation might be very helpful to you in the process -
https://spform.com/javascript-framework ... eld-values