Click here to Skip to main content
11,702,396 members (73,447 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: validation form
im using this form validation on my site:
http://jorenrapini.com/blog/javascript/the-simple-quick-and-small-jquery-html-form-validation-solution[^]

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 Los193.4K
v3
Comments
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
good
Please Sign up or sign in to vote.

Solution 1

Please follow below links:


jQuery-Form-Validation-with-Selects

validate-select-via-jquery

Validation

jquery-validation-for-drop-down-box



Don't forget to mark useful responses as Answer if they helped you towards a solution.
  Permalink  
Comments
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">
$(document).ready(function(){
$("#submit").click(function(){
var year = $('#year option:selected').val();
if(year == "")
$("#msg").fadeIn("slow");
{
$("#msg").html("Please select a year");
return false;

}
});
});
</script>

i tried adding this line under if(year == "") :
$("#msg").fadeIn("slow");

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 Maciej Los 455
1 Sergey Alexandrovich Kryukov 310
2 OriginalGriff 265
3 CHill60 145
4 Andy Lanng 99
0 OriginalGriff 8,369
1 Sergey Alexandrovich Kryukov 7,547
2 CPallini 4,922
3 Maciej Los 4,411
4 Mika Wendelius 3,556


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