Solved

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

Posted on 2010-11-19
3
349 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now