[jQuery] Getting started

[jQuery] Getting started


I am toying around with a form where I am using the validate plugin.
http://bassistance.de/jquery-plugins/jquery-plugin-validation/
What I am after is that before a form is submitted, an ajax query must
return true/false in order for the form to validate.
Example:
A select with country codes and names
User puts in a phone number
Clicks submit
Before submittal the form sends an ajax query with the phone number and
country code ( from the select's value attribute ) and gets a true/false of
whether the phone number contains enough digits for the country code. A
server side script validates the required number of digits.
Validator will then display something like "A phone number for the country
you have chosen requires X digits." Where X was returned by the ajax query.
I can use json to return the true/false and the number of digits required.
Here is what I have been toying with.
<script type="text/javascript" src="jquery-1.2.1.pack.js"></script>
<script type="text/javascript" src="jquery.validate.pack.js"></script>
<script type="text/javascript"><!--
$().ready(function() {
$("#phoneNumberForm").validate({
rules: {
phoneNumber: {
required: true,
minLength: $.get("validate.lasso", { countryCode:
$("countryCode").val(), phoneNumber: $("phoneNumber").val() } )
}
},
messages: {
phoneNumber: {
required: "Please enter a phoneNumber",
minLength: "Your phoneNumber must consist of at least 2
characters"
}
}
});

});
--></script>
I have been playing around with the selectors to see if I can submit the
correct data to the server at least. The server always says I have submitted
"undefined" for both.
I am new to jQuery so I thank any of you for any help you can offer.
Thanks
Steffan
---------------------------------------------------------------
T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4
Steffan A. Cline
Steffan@ExecuChoice.net Phoenix, Az
http://www.ExecuChoice.net USA
AIM : SteffanC ICQ : 57234309
YAHOO : Steffan_Cline MSN : steffan@hldns.com
GOOGLE: Steffan.Cline Lasso Partner Alliance Member
---------------------------------------------------------------