Click here to Skip to main content
11,798,866 members (74,145 online)
Rate this: bad
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 12:01pm
Edited 1-Apr-13 21:14pm
Maciej Los202.2K
ThePhantomUpvoter at 1-Apr-13 18:11pm
Why are you not asking Joren about his code?
jfiler20 at 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 at 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
0 CPallini 505
1 OriginalGriff 503
2 Richard MacCutchan 321
3 Maciej Los 245
4 phil.o 244
0 OriginalGriff 2,270
1 Maciej Los 1,810
2 KrunalRohit 1,496
3 CPallini 1,425
4 Richard MacCutchan 1,109

Advertise | Privacy | Mobile
Web01 | 2.8.151002.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