how to catch the submit/postback from a #umbraco contour form
This might seem a bit basic for some of you, but how would I catch a sucessfully submitted umbraco form in jquery in order to show a ajax/modal style thankyou message. Would I have to catch the submit button first and then do an ajax post of the form via jQuery?
for example $("#form").submit(function () { //send the form if no client validation errors
//if successful, fade in some nice message with jQuery shizzle etc.
I'm actually working on something like this right now. I don't have a publicly accessible URL, but I "stole" the idea from uComment. Have a look at how they do it.
This involves using the jQuery.validate plugin for validation and the jQuery.forms plugin to submit the form through AJAX.
I would advise you to install uComment somewhere in a test instance and have a look at how they're doing this and applying that technique to submit the form.
I am currently NOT dynamically creating the form fields from contour, so they're just hardcoded in the HTML. I have something sweet lined up to make that will make this really sweet and easy, but it's not ready for production yet...
I came up with a much quicker/hackier solution in the end, which I'm sure might make some of you cringe Something along the lines of:
$("#Form1").submit(function () { if ($("#quote-form .contourError").css("display") == "none") {
//cool, no errors! lets show a nice loading message, while the form is posting } else {
//nothing, let contour handle the errors as it usually does
}
});
if ($(".contourMessageOnSubmit").length > 0) { // the form must have posted ok, so let's do some more jQuery shizzle. }
how to catch the submit/postback from a #umbraco contour form
This might seem a bit basic for some of you, but how would I catch a sucessfully submitted umbraco form in jquery in order to show a ajax/modal style thankyou message. Would I have to catch the submit button first and then do an ajax post of the form via jQuery?
for example
$("#form").submit(function () {
//send the form if no client validation errors
//if successful, fade in some nice message with jQuery shizzle etc.
});
has anyone done anything similar using contour
I'm actually working on something like this right now. I don't have a publicly accessible URL, but I "stole" the idea from uComment. Have a look at how they do it.
This involves using the jQuery.validate plugin for validation and the jQuery.forms plugin to submit the form through AJAX.
I would advise you to install uComment somewhere in a test instance and have a look at how they're doing this and applying that technique to submit the form.
I am currently NOT dynamically creating the form fields from contour, so they're just hardcoded in the HTML. I have something sweet lined up to make that will make this really sweet and easy, but it's not ready for production yet...
thanks Sebastian, I'll look into uComment see how it's done.... will also keep an eye out for your dynamic solution
- Tim
I came up with a much quicker/hackier solution in the end, which I'm sure might make some of you cringe
Something along the lines of:
is working on a reply...