cancel
Showing results for 
Search instead for 
Did you mean: 

UI element 'required' prop to block navigation

Former Member
0 Kudos

Hi All,

I have a particular scenario where in:

There are multiple tabs in a single view and there are actions (buttons) in the view e.g. Save, Close etc.

Now, there are 2 UI elements (Input fields) in the 1st tab.

The query is: the property of second UI element (Input Field) should be set to 'Required' or 'Mandatory' based on the value entered in the 1st input field. (it is possible using Set_attribute_property( ) method).

So, when the second field is made the Mandatory, user should not be able to navigate to any other view or even able to go away from the screen (by clicking SAVE or CLOSE) unless data in provided to the second input field.   Currently, I am able to make this possible only when the user presses 'Enter' after entering data in the input field, but the check fails or navigation happens when the user just enters data and does not press enter and right away clicks on any other tab or SAVE CLOSE buttons.

Any help in this regard.

Thanks,

Ravish

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Ravish,

Yes you are true that the navigation code will not trigger unless the user hits ENTER key. Have you wriiten this code in OnEnter event of the second attribute. If Yes, then only it gets triggered when ENTER is pressed.

One question is where have you written this code?

One thing you can try:

Create the changelog event for 2nd input field (using change logs methods for that attribute)

and usually MODIFYVIEW will get trigger in such cases.

There are methods like get_change_log and when you can see that there isno change you can stop the navigation or you can control things.

You should be a little cautious  when you write  the code in modifyview as this gets triggered on every action of the view.

Former Member
0 Kudos

Hi Lekha,

Thanks for your reply.

I have not implemented anything for 'onenter' event in particular.

I have implemented the code to mark the field as mandatory in multiple places (just to try whichever works best) e.g. beforeaction, afteraction, beforenavigation.

Moreover, I have implemented the change log concept and that gives me information about the changes being in UI correctly but since I want the navigation to be altered or stopped etc, that does not help since I am not bounding the logic based on data as the I want the field to marked mandatory in all scenarios as first step, if it works, I will implement the change log based on the changes etc.

Thanks & regards,

Ravish

0 Kudos

Hi Ravish,

Bind the tab strip's attribute "SelectedTab" with context attribute, and control the tab movement using Context's attribute VALUE in the events on_enter or on_select.

Regards,

Mani