Avatar of sabecs
sabecs
 asked on

jQuery - set select list from value entered in different form on same page?

I have purchased a WordPress plugin called "Bookly" and would just like to know how to set the location tab using jQuery from another form.

http://locations-demo.booking-wp-plugin.com/demo/

I have a form on the same page as below, if say "San Francisco" is entered I need location "San Francisco" automatically selected in Bookly.
If a location entered my form is not listed I would like a message displayed "Sorry, we don't service the location entered"


<form action="search_for_members.php">
<div class="ui-widget" id="get_my_location">
<label for="my_location">Where do you need a Practitioner?</label>
<input id="my_location" onfocus="if(this.value == 'Enter Location') { this.value = ''; }" type="text" value="Location">
<input id="set_location" type="submit" value="Get Started">
</div>
</form>

Open in new window


Thanks in advance.
jQueryWordPress

Avatar of undefined
Last Comment
sabecs

8/22/2022 - Mon
Julian Hansen

The form you have above posts back to a script - which will refresh the page making a jQuery solution irrelevant because anything it does will be wiped in the refresh.

I think we need more pieces of the puzzle

Can you post your page - it is not clear what the form above is doing and what part it plays. Also need to see the tabs.
sabecs

ASKER
Thanks for your feedback, the form action can be removed, it's just their as an example.

I just need to know how to set the locations select list in Bookly from another select list.
Julian Hansen

Are the entry points free form? In other words does the user type in their location rather than select it from a list?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
sabecs

ASKER
Hi Julian, the user would select their location.
Julian Hansen

Then can you show me the real code because the code you posted has this
<input id="my_location" onfocus="if(this.value == 'Enter Location') { this.value = ''; }" type="text" value="Location">

Open in new window

Which implies free form entry.

Also - if the user is selecting the value - why would the select have a location you don't support?
sabecs

ASKER
Thanks Julian for your comments, very much appreciated.
Sorry, the website is under construction and blocked by a plugin to public, I can add your IP address if you would like to view?
"my_location" is coming from an autocomplete jQuery linked to a table that lists every location in Australia by zip/postal code but I need to check if Bookly members service the area selected. I am trying to customized the website/Bookly to check if an area is serviced.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Julian Hansen

my_location" is coming from an autocomplete
Hint: the more information you provide in the beginning the easier it will be to assist you. In future details like this should be included in your opening question :)

Again, I have the same question - if it is an autocomplete - why are you providing options that you may not support?
sabecs

ASKER
Thanks Julian, I am trying to customize the Bookly plugin.

My form will display all zip codes in my country, Bookly plugin will only display areas serviced.
If they select a zip code not in Bookly I want to display a "Sorry, we don't service the location entered" and redirect to another page.

If they do select an area that is serviced by Bookly then I want this selection made from the Dropdown list in Bookly.

I hope that makes sense?
ASKER CERTIFIED SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
sabecs

ASKER
I agree with you, it is annoying to tell a user that a zip codes is not available, I already have in place a list in Bookly that only presents available zip codes, but my customers want this option and that is what I have to give them.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck