Tuesday, October 27, 2009

[jQuery] Re: Submitting after Validation

Leonardo, I've been looking into the submitHandler option but i'm
having problems getting it to work correctly. Here is a sample of the
code i'm testing.

$("#signupForm").validate({

rules: {
fullname: "required",
company: "required",
phone: "required",
email: {
required: true,
email: true
}
},
messages: {
fullname: "Please enter your fullname",
company: "Please enter a company name",
phone: "Please enter a phone number",
email: "Please enter a valid email address"
},
submitHandler: function() {
form.submit();
}

});


<form class="cmxform" id="signupForm" method="POST"
action="process.php">
<div class="formline">
<label for="fullname">* Name:</label>
<input type="text" id="fullname" name="fullname"
class="textbox" />
</div>
<div class="formline">
<label for="company">* Company:</label>
<input type="text" name="company" id="company"
class="textbox" />
</div>
<div class="formline">
<label for="email">* Email:</label>
<input type="text" name="email" id="email" class="textbox" />
</div>
<div class="formline">
<label for="phone">* Phone:</label>
<input type="text" name="phone" id="phone" class="textbox" />
</div>
<div class="formline">
<label for="message">Message:</label>
<textarea name="message" id="message" class="messagebox"></
textarea>
</div>
<div class="formline">
<label for="button"></label>
<input type="submit" value="Submit" alt="Send Message" />
<input type="hidden" name="subcontact" value="1" />
</div>
</form>


On Oct 27, 1:42 pm, Leonardo K <leo...@gmail.com> wrote:
> Look the submitHandler option:
>
> http://docs.jquery.com/Plugins/Validation/validate#toptions
>
> On Tue, Oct 27, 2009 at 15:02, StephenJacob <turnstylecreat...@gmail.com>wrote:
>
>
>
> > I'm trying to create a contact form using Jquery Validation and Ajax
> > Submit. I'm having a problem figuring out the best way to submit the
> > results to a php file.  Below is a break down of my validation code.
>
> > $().ready(function(){
>
> > $("#signupForm").validate({
>
> >        rules: {
> >                fullname: "required",
> >                company: "required",
> >                phone: "required",
> >                email: {
> >                        required: true,
> >                        email: true
> >                }
> >        },
> >        messages: {
> >                fullname: "Please enter your fullname",
> >                company: "Please enter a company name",
> >                phone: "Please enter a phone number",
> >                email: "Please enter a valid email address"
> >        }
>
> > });
>
> > });

No comments: