Copied to clipboard

Flag this post as spam?

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

  • Paul Stewart 50 posts 71 karma points
    Apr 17, 2012 @ 11:30
    Paul Stewart

    JQuery After Submit, Show Alert Box

    Hey guys, I have a client that wants to have track the number of submissions using "adTracking" which to me why? why not use google analytics, but anyway! 

    My problem is I can track the clicks of the ".contourButton" class, but I can't track the number of page submissions. 

    just like on your basic RenderForm.ascx from umbracoContour, Im wanting to control when the placeholder with the thank you message 

    RenderForm.ascx (snipplet)

    <asp:PlaceHolder ID="ph_messageOnSubmit" runat="server" Visible="false">
    <div class="showThankYou">
    <h2 class="contourMessageOnSubmit">
        <asp:Literal ID="lt_message" runat="server" Visible="false" /><umbraco:Item field="#Thank You" runat="server" />   
    <p><umbraco:Item field="#Our Representive" runat="server" /></p>


    JQuery snipplet

    <script type="text/javascript" src=""></script>
    jQuery(document).ready(function ({
       jQuery(".contourSubmit").click(function ({
       jQuery('.contourSubmit').submit(function ({
                  alert("form was submitted")

    Mean I've tried different alternatives, but my knowledge of jQuery is quite limited. mean for the time being if i can get the alert box to display when the form is submitted then I will be happy as larry and I can do what I need to do with the rest.

    If someone change help me I would be most highly grateful! 


  • Grant Thomas 291 posts 324 karma points
    Apr 17, 2012 @ 11:57
    Grant Thomas

    The problem would be in subscribing to the `submit` event of the input (button), you should hook this event up to the `form` as per the jQuery documentation; I'm not sure how Contour works with what version of Umbraco you're using, but with it doesn't generate it's own form - so this might not work for you. But if it does, and you're using a validation framework with a generic way of checking for valid submissions then you could essentially just have one 'global' validation routine for submit on the (or a named) `form` tag.

    Other than that, if hooking into the form won't do it for you, you could possibly try validating within the `click` event and simply use `e.preventDefault()` if invalid (you would need to add the `e` parameter argument to the even function.)

Please Sign in or register to post replies

Write your reply to: