Condition on Next button

rss

Posted by Katy - Feb 22 ’17 at 02:15

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?

 

 

 

 

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 23 days
    #1 by Dmitry Kozlov Feb 27 ’17 at 03:52

    Hi,

    Try to return 'false' after alterting.

Displaying 1 to 1 of 1 messages