Stop Tab Deselect

  • 14 January 2016
  • 3 replies
  • 1 view

Badge +3

The title pertains to a specific issue but my question is much broader.

 

Can you prevent an Event from completing? For instance I have a tab with two tabs, if the user clicks the second tab but they need to complete a field on the first tab, I want to be able to run a validation and stop the Deselect event from happening so the user stays on the first tab.

 

I would like to be able to Add a Rule

 

When MyTab Is Deselected

If someAdvancedCondition

then Stop Rule Execution

 

Which would prevent that action from happening and keep the user on the first tab, my tests show this doesn't work. Is there a way to stop the default processing of an event?

 


3 replies

Userlevel 1
Badge +8

Hi Nigel

 

I created a form with two tabs (Panel A and Panel B). On Panel A I added a text box. Then I added a rule for the event "When Panel B is selected" and added a condition to check if the text box has a value. If it does not then I called the action to move to Panel A. This did not work, however when I added a message box action before the move to tab action, it did work. So for some reason the move to tab action will not fire unless there is the interruption of the message box.

 

The form will display Panel B when you select it, but will move back to Panel A immediately after you click OK on the message.

 

You can do the same thing using the "When Panel A is Deselected" event, but it will achieve the same results.

 

 

13955i565D06AB35D1B260.png

Badge +3

Thanks for your response Andrew, I went about it the same way. 

 

In Javascript one can return false or use e.Handled=true in WPF to halt an event, is that concept an option in K2? 

 

Userlevel 1
Badge +8

Nigel, I am no Javascript expert, so I don't know the answer to that, except to say you can drop javascript snippets onto forms (e.g. in a datalabel).

Reply