Forum Academy Marketplace Showcase Pricing Features

Creation from Reusable Element Popup to populate Filed

I have a field where it asks for City which is a Data Type. In the search they will search and if they don’t see their city in the selection they can click the add city text. This opens up a Reusable element popup named “Add City”. This will create the new city, and then I have on the save button of the popup to save a state of the city for the newly created city.

Then, on the page I added this popup element I have when the popup is closed Set the pages “Current_city_STATE” to the City State of the popup. With there now being a new city in the page’s state it should hide the search bar and display the city, but I can’t get this to work. Any idea why? Is it not carrying over the State save from the reusable element? I’ve tried resetting the group to see if it would then display, but nothing.

Suggestions?


Hi there Eric.

It’s probably worth temporarily showing your page’s Current_city_STATE in a text box so you can debug this.

I wonder if you’d be better to simplify the steps a little. You are setting the reusable popup’s state as the new city. The page itself can refer to the reusable popup’s state(s), so you could potentially skip the step of setting the page’s state, if that makes sense.

So your search bar group could then have a condition on it “if popup state is not empty turn this group’s display off”.

Hope one of those two things helps. If you need anything, give me a shout.

James
AppEDGE

Great advice. I added the text, and when I add a new it does not populate anything into the state, so it does not seem to be reading the reusable element’s states.

The reason I use the page State is that most people are selecting Cities already in our database. The Add city is only when we don’t have a city in the database it’s a way for them to add it.

The workflow is they search for a city, and if it’s in the database they select it from the search bar, and it populates the page’s State. If it’s not, they then click the add new city button and the popup comes up. After they add it I would love for that city they added to just be set as the page’s state, but currently, the popup closes and no city is entered. They then have to go to the search thing and search for the city again to add it. this is not always obvious and I fear it will cause confusion.

Hey Eric. Sorry for the delay.

I don’t think you need to rely on the “popup is closed” event. My approach would be:

  • On the popup have a custom state called “City”. The state should exist at the popup’s top level, as it were - i.e. so that it’s available for your page to refer to. When (if) the user adds one, set that state to the new city.

  • On your page you then have two options:

    1. Simply have conditions on the search/display city elements to hide/show them based on whether popup’s City state is not empty.

    2. Have a workflow event “Do when condition is true” (set to run every time) – popup City is not empty. That can then be used to set your page’s state.

If you struggle to get this sorted, happy to jump on a quick call - it’s something we could get working pretty quickly.

Hope that helps.

James
AppEDGE

Hello James, thank you for your help on this. I tried going with the option 2, but does not seem to be working.

Human error, I found out I was selecting the Popup’s Data Source not its City State. On button press I was setting the state and not the data source of the popup.

OK, is it better to use on popup close or, every time a condition is true?

Thanks for letting us know Eric - glad you figured it out. These things can be frustrating! Probably not much to choose between the two approaches in reality, so whatever makes most logical sense to you.

Good luck with your project :grinning:

James
AppEDGE