Hi all,
I have a single page app and am starting to convert some groups into reusable elements. I have one reusable and I want to show a popup when “Save” is clicked but the popup isn’t available when I try and Show an element?
I tried to set a custom state on the index page, something like “show-popup” so that I could allow the popup to Show when the custom state is Yes, but again I am unable to refer to the index page because I am on a reusable?
I clearly need to know the basics of using reusable whilst referring to index elements. Any advice?
You can’t refer to a page from within a reusable element…
You have to use custom states on the reusable element itself…
Then, on the page, you can use conditional workflows to trigger things on the page based on the RE custom state values.
1 Like
Thanks but it not working, I must be doing something wrong.
I have a “Yes/No” custom states on the reusable element and when the ‘Save’ button is click on the reusable element it triggers a workflow which set’s the custom state to “Yes”.
Now, I go back to my index page and open the popup, I tried to set a condition to Show when the reusable custom states is “Yes” but that option is not available. Is this not the way to do it?
No, you can’t show popups using conditions, only using workflow actions…
So you need to use a conditional workflow for this as I said…
But I can’t use a conditional workflow because the button on the reusable element which needs to generate the popup doesn’t allow me to choose the custom state.
I know I don’t understand, sorry about that.
Just run a workflow when the RE custom state value is ‘yes’ (add a 'do when condition is true workflow event) …
(you’ll need to make sure it’s set to run ‘every time’, and you’ll need another workflow to reset the custom state value to ‘no’ anytime the popup is closed).
I don’t see an option for '‘do when condition is true workflow event’? Sorry I am very confused as never used reusables before.
Here’s a summary of where I am with this;
- Reusable element = custom states “_show-success”
- Reusable element has ‘Save’ button which should show ‘Popup Success’
- Popup success has ‘Close’ button which has a workflow to set “_show-success” to “No”.
- Question: Where do I set “_show-success” to “Yes”?
I don’t see an option for '‘do when condition is true workflow event’? Sorry I am very confused as never used reusables before.
Where are you looking? It’s a ‘General Workflow Event’ (do when condition is true)…
- Question: Where do I set “_show-success” to “Yes”?
Well, I’ve no idea (as I don’t know what you’re trying to do), but I’m guessing you want to set it after whatever it is you’re saving has been successfully saved, no?
So set it at the end of whatever workflow you use so save the thing you’re trying to save.
Sorry I have no idea what you mean … this is one of those occasions where I need images I think. Don’t worry I will find a way around this but I appreciate you trying to help.
Thank you, no wonder I was confused, I haven’t used Workflow Events before …! Ok, so I went to the button on the reusable and added a General Workflow Event but again I am unable to refer to the popup?
I’m looking for my popup
You must have done!! You can’t run a workflow without using an event! - all workflows consist of an Event (which is the trigger), and some Actions (which are the actual things the workflow does) …
Ok, so I went to the button on the reusable and added a General Workflow Event but again I am unable to refer to the popup?
No, no… this has nothing to do with a button, and nothing to do with the Reusable Element…
You need to run this workflow on the page (not the RE)… the Popup is on the page, so you can’t access it from within the RE (which is the entire reason you need to run a ‘When condition is true event’ workflow in the first place)…
So make sure you’re on the page itself, then create the workflow, and add an action to show the popup…
As i said previously, you’ll also need to run another workflow (on the page) to set the RE state back to ‘No’ whenever the popup is closed (unless the popup can’t be closed by pressing ‘Esc’, in which case the workflow you’re running when the popup’s ‘close’ button is clicked will be sufficient)…
1 Like
Ah I think I understand now … I will give this a go and once again thanks for your help!
1 Like
Well done @adamhholmes! I got exhausted just reading through this one… nice persistence.
1 Like
@bubble.trouble Sounds like that was a jab at me.
no, just sometimes its hard to remote debug. A compliment to someone else doesn’t imply something less to you. Just a job well done for @adamhholmes sticking in it with you to help get the problem solved.
2 Likes
No I never have, the only time I enter the workflow page is by right clicking on a button and select Start/edit workflow. I’ve not clicked the ‘Click here to add an event’ box before. Also, the box “Click here to add an event” is burried way down at the bottom which is the last place I would have thought to look! Not sure why it’s not at the top but hey…
@adamhholmes Thank you very much for the solution and final clarification, I understand now and have it working.
To help others I will summarize how to show a popup from a reusable;
Assuming a single page app, the reusable has a button ‘Save’ which needs to open a popup…
-
Create a custom state on the reusable page, such as _show_popup
then on the reusable’s ‘save’ button workflow you set the state of _show_popup
to ‘Yes’
-
Go to the index page’s workflow and click “Click here to add an event” which found at the bottom of the workflow page. Choose ‘do when condition is true’ and select ‘Run this always’. Show the popup only when the reusables_show_popup
is ‘Yes’ (see image)
-
The popup close button needs to set the reusables_show_popup
to ‘No’
2 Likes