Forum Academy Marketplace Showcase Pricing Features

Dropdown default value

I want to set the default value of a dropdown to be the name of current geographic location (country name) on page load. How can i do that ?

Hi Zahoor :slight_smile: If you use the Searchbox element, you can extract the country name for the default value using these settings:

This way you can save it as a geographic address as well. Is this what you were hoping to achieve? Or do you need to use the Dropdown element with dynamic or static choices?

I want to use dropdown element with dynamic choices and then want to set a default value on page load.

What’s the choices source you are using for the dynamic choices? Can you share a screenshot or a link to your app?

I have database “Country” from which my dropdown D picks and shows country names. Now i want the dropdown to show the current visitor’s country as default value of dropdown on page load without any choice selection from app visitor.

Ok these settings should do it (let me know if not): :slight_smile:

I am getting this error, please help

I would think for the default to be valid you would need to do a search for Country with a constraint that it is = to current geo :extract country. I’m assuming that you want the country to be a valid location currently in your data. Can you share a link?

Almost there! The Type of Choices should be “Text” for this, instead of “Country”. Since you’re needing to display the User’s current geographic location, and extracting the country, that is a text value, not a stored Country in your database. By changing the Type of Choices to Text, the choices source is composed of text values: Search for Country’s Names (list of texts) :plusitem “current geographic position: extract country” (single text value).

*I assumed the Name field was type text in your database - is it type: geographic address?

Yes it worked for me now, great help thanks.


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