Hello, I've gotten my validation to work on everything except my select boxes. I don't know what the rule is that I would need to put into my page to get it to work. Can anyone help me?
Here's my form code:
And here are the rules that I've set already.
"shirt" and "events" aren't working because there IS a selected option already: "Select One". Now what I'm wondering is if I can exclude that option and have it validate the rest.
I got it. All I needed to do was change to
Don't know why I didn't think of that before. :S
Here's my form code:
Code:
<form action="http://www.researchride.com/register/process.php" method="post" onsubmit="return rsv.validate(this, rules)">
<ul>
<li>
<input name="form_tools_form_id" type="hidden" value="1" /></li>
<li> <label class="name" for="name">Full Name:</label>
<div>
<input name="name" type="text" /></div>
</li>
<li> <label class="email" for="email">Email:</label>
<div>
<input name="email" type="text" /></div>
</li>
<li> <label class="shirt" for="shirtsize">Shirt Size:</label>
<div>
<select id="shirt" name="shirtsize"> <option value="Small">Small</option> <option value="Medium">Medium</option> <option value="Large">Large</option> <option value="X-Large">X-Large</option> <option value="XX-Large">XX-Large</option> <option value="XXX-Large">XXX-Large</option> </select>
</div>
</li>
<li> <label class="events" for="events">Participating In:</label>
<div>
<select id="events" name="events"> <option selected="selected" value="Select One">Select One</option> <option value="Lunch-Only">Lunch Only</option> <option value="Both">Ride and Lunch</option> </select>
</div>
</li>
<li>
<div>
<input id="submit" class="submit-button" name="submit" type="submit" value="Sign Up" /></div>
</li>
</ul>
</form>
</div>
And here are the rules that I've set already.
Code:
<script type="text/javascript">
var rules = [];
rules.push("required,name,Please enter your full name.");
rules.push("required,email,Please enter your email address.");
rules.push("valid_email,email,Please enter a valid email address.");
rules.push("required,shirt,Please enter your shirt size.");
rules.push("required,events,Please indicate what you will be participating in.");
// *IMPORTANT!* these lines are required if you're using the rsv.js file that's bundled
// with Form Tools. They reset the custom options used throughout the main Form Tools
// script that won't be needed for your own forms
rsv.errorFieldClass = null;
rsv.customErrorHandler = null;
rsv.displayType = "display-html";
</script>
"shirt" and "events" aren't working because there IS a selected option already: "Select One". Now what I'm wondering is if I can exclude that option and have it validate the rest.
I got it. All I needed to do was change
Code:
<option selected="selected" value="Select One">Select One</option>
Code:
<option selected value="">Select One</option>
Don't know why I didn't think of that before. :S