Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Popover button behavior with script triggers

Featured Replies

I have a pesky problem with trying to implement popovers to replace some older picker popups.

 

I have created a popover, and attached an OnObjectEnter script trigger and an OnObjectExit script trigger (to the popover itself, not the button).

 

The OnObjectEnter script sets some variables to prepare the popover for portal data selection.  This works fine.

 

The OnObjectExit script trigger clears the variables.  I have a Cancel button on the popover that executes Close Popover command, which triggers the OnObjectExit script trigger to clear variables.  This works fine.

 

The problem is when you click the popover button itself again.  I've noted the default behavior on the popover button is to toggle the popover on and off.  But for some reason, whenever I click this button to close the popover with the script triggers in place, it closes and then immediately opens again.  The OnObjectEnter script trigger fires for some reason, and I cannot figure out why.

 

I have read that the OnObjectExit executes before, and OnObjectExit executes after, but I can't figure out why the OnObjectEnter script trigger fires when the popover button is toggled to close the popover, or how to squelch this behavior, since there doesn't appear to be any way to detect the current state of the popover.

 

Hopefully this description makes sense.  Can anybody explain what's happening here, and how to fix it?  It's a minor annoyance, since the Cancel button on the popover works (and so does clicking on the layout outside of the popover), but it's one I'd like to address if possible.

 

Thanks for your time!

Have the OnObjectExit trigger check on a flag $$, say $$EXIT; if it's not set, return a script result of False, which will cancel the exit and any clicks outside the panel, including the one on the popover button.

 

To actually allow leaving the popover in order to perform your Cancel, Save or other scripted actions, set the $$ to True (and don't forget to delete it when all is said and done, so the next invocation of the popup starts with the correct state, i.e. the variable not being defined).  

  • Author

Right, thanks!  Should've thought of this, I use similar logic to squelch unwanted script triggering in other places in my solution.  My brain must be on vacation today  :hmm:

  • 10 months later...

Have the OnObjectExit trigger check on a flag $$, say $$EXIT; if it's not set, return a script result of False, which will cancel the exit and any clicks outside the panel, including the one on the popover button.

 

To actually allow leaving the popover in order to perform your Cancel, Save or other scripted actions, set the $$ to True (and don't forget to delete it when all is said and done, so the next invocation of the popup starts with the correct state, i.e. the variable not being defined).  

 

Two questions, why do you set the flag as a global variable and how do you delete it when done?

Two questions, why do you set the flag as a global variable

 

Because it needs to be preserved between the two events that trigger your script(s) (OnEnter, initialize, OnExit, query (then delete)).

 

and how do you delete it when done?

 

In the exit script (or exit part when using a single script to handle the entire process).

In the exit script (or exit part when using a single script to handle the entire process).

 

Sorry eos, I understand now. Thanks. What I did not understand when I made my post was how to clear a global variable. Now I see that all you need to do is set it to nothing (Set $$MyGlobal to "").

Sorry eos

 

Sorry for what? :smile: Anyway, I thought your question referred to the timing, not the mechanics.

 

Now I see that all you need to do is set it to nothing (Set $$MyGlobal to "").

 

Right; when you do that, it's not even empty, it's undeclared.

Sorry for what? :smile: Anyway, I thought your question referred to the timing, not the mechanics.

 

 

Right; when you do that, it's not even empty, it's undeclared.

 

Oh, this is good information.  I was wondering how global variables got "deleted."  So, when a global variable is no longer needed, is it best practice to set it to "" so that the variable is not taking up any memory?

So, when a global variable is no longer needed, is it best practice to set it to "" so that the variable is not taking up any memory?

 

Yes.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.