Detect field value changes in a panel and prevent switching to another panel

Avatar

Avatar

tarekahf

Avatar

tarekahf

tarekahf

01-07-2020

I have done the following:

- Developed Adaptive Form with navigation tabs on the left

- Used fragments and implemented a lazy loading

- In my code, I can detect navigation changes using guideBridge events

- The fragment will be loaded lazily, and the guideBridge event "elementLazyLoaded" is triggered when the user clicks on the relevant tab, and the data get loaded successfully only for that fragment. All is working like a charm.

 

Problem: I noticed when the user switches the navigation from one fragment to another, the previous fragment is unloaded and the new fragment is loaded. This happens only of both previous and new fragments are configured to load lazily. This means, if the user switches to fragment "a" and make some changes and doesn't save the data, then switches to fragment "b" and then to fragment "a" then the changes made in fragment "a" will be lost, since the fragment event "elementLazyloaded" will be triggered every time the fragment has the focus.

 

Questions:

 

- I can detect navigation changes using the "elementFocusChanged" or "elementNavigationChanged" events, but how I can prevent the navigation to take effect if the user made some changes to any field in the panel that has focus?

 

- I can use the guideBridge events to detect changes to a field in a panel, but this requires some scripting overhead. I was wondering if there is an easier method to detect c change such as making use of a form "dirty" flag as we used to do in Angular.

 

I was thinking to use completion expressions with setFocus(somExpression [, focusOption] [, runCompletionScript]) API, but this requires the use of the Wizard layout as per my understanding. 

 

I appreciate your feedback.

 

Tarek

Accepted Solutions (0)

Answers (0)