How to cancel navigation?

Questions and answers for designing and implementing forms in Servoy

How to cancel navigation?

Postby sergei.sheinin » Wed Jun 18, 2014 12:20 pm

I have a form with tabless panel that contains another form. When navigation on parent form is clicked I would like to prompt a user with "Cancel: yes/no" choice in case changes were made to child form and not saved. I am trying this:

Code: Select all
// form's "onRecordSelection" event
function nav(){
   if( plugins.dialogs.showQuestionDialog('Confirm','Cancel?','yes','no')==='no'){
      return false}}


If I click "no" the actual navigation doesn't happen but row number in the navigator changes to next record. Obviously it should stay at same record number.

How can the desired functionality be attained?
Sergei Sheinin
JavaScript, RDBMS
http://js2dx.com
sergei.sheinin
 
Posts: 79
Joined: Wed May 07, 2014 3:22 pm

Re: How to cancel navigation?

Postby jcompagner » Thu Oct 23, 2014 12:26 pm

returning false on a on record selection doesn't do anything
Because that is an "after the fact" event so the selection is already changed.

So you just have to set it back to the desired selection.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Forms

Who is online

Users browsing this forum: No registered users and 5 guests