Form Validation

Oops, yeah you also need to change the type attribute to submit, not button, sorry!

Thanks, just updated that.

So basically on button submit it runs through the validation, then if all good to go I execute that ajax script to run the upload.

I think I got it, but could you give me a heads up with it, with the code Iā€™ve already got there.

Thakns again though fretburner

AHA!

I just uploaded to the live page and the validations is sort of working I think, amazingā€¦

Please could you highlight how I get from a successful validation to the function (serviceCall()) for the upload of the data via the ajax script inside that

Did you take a look at that link from post #40? Where the example shows a function being assigned to the submitHandler property, assign your function that submits the data via Ajax:

submitHandler: serviceCall

This will trigger the submission of the form if validation is successful.

Hi fretburner,

Its not quite working out, the validation is perfect but I cant get the success handler to run the function servicecall()

<script>
$("#signupForm").validate({
rules: {
fname: {
required: true
},
},
messages: {
fname: "Please enter your firstname",
},
submitHandler: function(serviceCall) {
form.submit();
}
});
</script>

<script>
function serviceCall() {

}
</script>

Its going to be something very small I know, but have tried a few things

Sorry fretburner, its this isnt it

submitHandler: function(form) {
serviceCall(); 
}

Thanks for all your help,

No worries, glad you got it working.

You can even do away with that extra function by assigning the serviceCall function directly to submitHandler:

submitHandler: serviceCall
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.