Solved

Advice on how to make sure end user knows they must select from a list

Posted on 2010-11-19
3
353 Views
Last Modified: 2012-05-10
Hi Experts,

I have an autocomplete function which brings back an array of iID and values.
The values are displayed to the user.
When selected the corresponding ID is stored in a hidden field.

I need to enforce the rule that if the user doesn't choose from the list (ie ID hasn't been set) then
they cannot carry on.  However, as the ID field is hidden, I am having trouble trying to come up with an elegant way of displaying this to the user.

Just after some advice on how you would tackle this problem!

Thanks
0
Comment
Question by:jagku
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 34172404
$("#formID").submit(function(e) {
     if( $("#listID").attr("selectedIndex") == 0 ) {
           e.preventDefault();
           alert("select something in the list!");
     }
});
0
 

Author Comment

by:jagku
ID: 34256258
Hi,

Apologies for the delay - I will take a look at this solution in the next fortnight and will come back to you.

Thanks
0
 

Author Closing Comment

by:jagku
ID: 34267086
Thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lazy load not working with masonry js 1 20
Google Maps API and PHP 25 34
Button to go back 3 25
How can i  prevent default  Submision? 6 27
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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

803 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