Solved

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

Posted on 2016-09-27
10
84 Views
Last Modified: 2016-10-09
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.
0
Comment
Question by:sabecs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 41819527
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.
0
 

Author Comment

by:sabecs
ID: 41821110
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.
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 41821185
Are the entry points free form? In other words does the user type in their location rather than select it from a list?
0
Report: Liquid Web beats Amazon, Rackspace & More

A study by performance analyst firm Cloud Spectator finds that Liquid Web beats rivals Amazon, Rackspace and DigitalOcean when it comes to website and cloud application performance.

 

Author Comment

by:sabecs
ID: 41821200
Hi Julian, the user would select their location.
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 41821210
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?
0
 

Author Comment

by:sabecs
ID: 41821375
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.
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 41821399
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?
0
 

Author Comment

by:sabecs
ID: 41825020
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?
0
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 41825172
I still think that is problematic. When you provide the user with an option to select his / her ZIP and then after the fact tell him it is not available - it can be annoying.

Is there not some way you can make your autocomplete only show the supported ZIP? Create a service that interrogates Bookly and only presents the available ZIP's.
0
 

Author Comment

by:sabecs
ID: 41828891
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.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question