Return to Snippet

Revision: 30330
at August 12, 2010 03:51 by dan_hoerr


Updated Code
jQuery.validator.addMethod(
  			"selectNone",
  				function(value, element) {
				//alert(element.options.selectedIndex);
    				//if (element.value == "blank"){
					if (element.options.selectedIndex == "0"){
      				return false;
    				}
    				else return true;
				},
  				"Please select an option."
			);
			
			$(document).ready(function(){ 
			
   				 
			$("#freshmen").validate({
				  rules: { 
	      			program1: { 
	        			selectNone: true 
    			 	} 
				  }
				 
			});

Revision: 30329
at August 12, 2010 01:51 by dan_hoerr


Initial Code
$(document).ready(function() { ;
			jQuery.validator.addMethod(
  			"selectNone",
  				function(value, element) {
    				if (element.selectedIndex == "0"){
      				return false;
    				}
    				else return true;
  					},
  				"Please select an option."
			);
   				 
			$("#freshmen").validate({
				  rules: { 
	      			program1: { 
	        			selectNone: true 
    			 	} 
				  },
				 
			});

Initial URL

                                

Initial Description
requires that a pulldown \\\"program1\\\" in form \\\"freshmen\\\" be set to anything but the first value in the option list.  \\r\\n\\r\\nrequires jquery validate: http://docs.jquery.com/Plugins/Validation

Initial Title
Drop down validation

Initial Tags
dropdown, jquery, validation

Initial Language
JavaScript