Click here to Skip to main content
11,933,854 members (34,896 online)
Rate this:
Please Sign up or sign in to vote.
See more: validation form
im using this form validation on my site:[^]

the problem is that it doesnt mention the code for a select box.

can anyone give me the code for validating a select box?
my select box name and id is "country"
and if the selection stays on "country" i want an error notice
Posted 1-Apr-13 13:01pm
Edited 1-Apr-13 22:14pm
Maciej Los210.1K
ThePhantomUpvoter 1-Apr-13 18:11pm
Why are you not asking Joren about his code?
jfiler20 1-Apr-13 18:16pm
because he has been asked that on his site about a month ago but never replied!

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please follow below links:





Don't forget to mark useful responses as Answer if they helped you towards a solution.
jfiler20 2-Apr-13 10:46am
ok thanks...just one more thing
now that I got the code for the select box validation, i want the error text to fade in.

this is my code now:
<script type="text/javascript">
var year = $('#year option:selected').val();
if(year == "")
$("#msg").html("Please select a year");
return false;


i tried adding this line under if(year == "") :

but it doesnt fade...
any ideas how to make the error alert fade?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 2 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100