Condition on Next button
Posted: 22 Feb 2017
Hi, I have a Next button which is saving the item while editing (i have actually 6 of them: one on each tab) with this code:
var active = $( "#fd_tabcontrol-0" ).tabs( "option", "active" );
$.cookie("fd_tabcontrol-0", active+1);
fd.sourceFormParam(window.location.href);
fd.save().click();
I need to place a condition to each button to check the fields on that particular tab and give people worning like: You haven't populated all the fields, do you want to continue?" so if people click OK - it will save and proceed, if Cancel - stay on the tab.
So i have this condition which works:
if (fd.field('Choice1').value() == "" || fd.field('Choice2').value() == "") {
alert('You haven't populated all the fields, do you want to continue?');
return true;
}
I tryed to put it before fd.save, but nothing is happening.
Is it possible to do?
var active = $( "#fd_tabcontrol-0" ).tabs( "option", "active" );
$.cookie("fd_tabcontrol-0", active+1);
fd.sourceFormParam(window.location.href);
fd.save().click();
I need to place a condition to each button to check the fields on that particular tab and give people worning like: You haven't populated all the fields, do you want to continue?" so if people click OK - it will save and proceed, if Cancel - stay on the tab.
So i have this condition which works:
if (fd.field('Choice1').value() == "" || fd.field('Choice2').value() == "") {
alert('You haven't populated all the fields, do you want to continue?');
return true;
}
I tryed to put it before fd.save, but nothing is happening.
Is it possible to do?