Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • wolulcmit 357 posts 693 karma points
    Nov 10, 2010 @ 19:15
    wolulcmit
    0

    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

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Nov 11, 2010 @ 12:26
    Sebastiaan Janssen
    0

    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... 

  • wolulcmit 357 posts 693 karma points
    Nov 11, 2010 @ 12:40
    wolulcmit
    0

    thanks Sebastian, I'll look into uComment see how it's done.... will also keep an eye out for your dynamic solution

    - Tim

  • wolulcmit 357 posts 693 karma points
    Nov 12, 2010 @ 13:04
    wolulcmit
    0

    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.
    }




  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies