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

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
jagkuAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
leakim971Connect With a Mentor PluritechnicianCommented:
$("#formID").submit(function(e) {
     if( $("#listID").attr("selectedIndex") == 0 ) {
           e.preventDefault();
           alert("select something in the list!");
     }
});
0
 
jagkuAuthor Commented:
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
 
jagkuAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.