Forum Academy Marketplace Showcase Pricing Features

Setting an element's value

Hi again, new to Bubble. I’m trying to set the value of an element in one page, to the value of an element in another page. The worst is that I haven’t figured out any method to set a value of any element at will. Please tell me there is a way, otherwise I will have a big issue with using Bubble.

Hey @justsendthemail :slight_smile: Can you provide more information on what you are trying to accomplish in your app? Sharing a link to the editor would be helpful if you can.

1 Like

Hi @justsendthemail, welcome to Bubble! There are many ways to pass data between elements and pages. Could you share some specifics of what you’re trying to do? With some more info, I can help you with methods.

1 Like

Thanks for the quick replies !!

I will explain, but first here is the link to the editor (I just copied the URL from the browser):

EXPLANATION:

I display a map on the Index page, on top of the map I have an input search field which is referenced by the map to set it’s center pointer. For now the map is a single pointer map. There is also a button that calls a pop-up to add that address to a database of “businesses”.

Then I have another page that displays the list of businesses in the database in a repeating group.

What I want to do is allow the user to click on any of the list’s addresses which would pass that address to the search input in the Index page and therefore cause the map to re-position its center to that address.

I think the app may still be set to private - can you set it to public temporarily? :slight_smile: (This can be done in the Settings Tab on the left hand side --> Application Rights --> Everyone Can Edit).

I’m on mobile now so can’t check out your link yet, but my first suggestion is to use a URL parameter. So, when the user clicks on an address:

Navigate to index and “send additional parameters”. Set your key label to anything you want like “address” or “search” and the value to that cell’s address.

Then on index page, have a condition on the input:

When “get data from URL” is not empty > set initial content to “get data from URL”.

Now, you’ll have to click again on “get data from URL” to actually indicate which URL parameter you want to read (because you can have multiple if desired). Type in the key you set (“address” or “search” as suggested above) and the expression will actually change to “get [key] from URL”

You’ll notice that once you’ve navigated to the index after clicking on the business in the RG, your URL will have the parameter at the end. Something like “myapp.com?address=value

Try that.

2 Likes

It’s public now.

Thanks! I’ve located everything and set it as indicated, however I seem to get lost between the expected types of data and the parameter’s. It’s a bit confusing.

UPDATE: I finally lined it up and it works!

I have a few loose ends though; I have two logo images going to the Index page when clicked. Bubble is telling me to pass a value to the Index page, but what I want is for Index to keep the address unchanged. Right now when I click either image, it goes to the Index page (I pass no value) and sets the input value to blank, therefore the map pointer goes to whatever default google has. How can I keep the input value unchanged when coming from clicking on the images? Additionally… how can I NOT reload the Index page when clicking on the images if I already was on the Index page?

Right now, the index page has a “Type of Content: business”:

When a type of content is defined for a page, Bubble will require any workflows to that page to send data. For example, if your index page was designed to display dynamic data whose value was “Current Page’s Business”, you would need to tell Bubble which Business’ information should be displayed once the Index page loaded. Without that, either Lorem Ipsum text will be displayed or certain elements will display blank information (that’s why the error comes up). If you remove the type of content, the errors will go away. The page shouldn’t reload when the User is already on the index after you remove the type of content.

Let us know if this works! :slight_smile:

Thanks !! Everything worked great, with the only exception of the page reloading when image, that sits in the “header”, navigates to the same page when clicked.

1 Like

Hi @justsendthemail! Awesome! :slight_smile: I would add a constraint to the workflow action on the logo which is:

“When logo is clicked” --> Go to Page: Index (Only When: Current page’s name is not Index).

This topic was automatically closed after 70 days. New replies are no longer allowed.