Copied to clipboard

Flag this post as spam?

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


  • Peter Cort Larsen 421 posts 1038 karma points
    Oct 12, 2010 @ 14:24
    Peter Cort Larsen
    0

    action

    Hi, can i specify a page to redirect the user to after he submits?

  • Eran 292 posts 436 karma points
    Oct 12, 2010 @ 16:17
    Eran
    0

    hello peter,

    in this version you can't, because after the submit, the user is stay in the same page (it submit the form in ajax without page refresh).

    what you can do, is to change the code, so after submit, the page will be redirect. you can do that in several ways, one way that i thinking about, is to use jquery to do that: http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery

  • Peter Cort Larsen 421 posts 1038 karma points
    Oct 12, 2010 @ 20:32
    Peter Cort Larsen
    0

    Yes , perfect. Thank you.

    Here is what i did:

    The code in bold is my changes.


    $(document).ready(function() {


        $(window).unload( function () { GUnload(); } );
        $("input[type=button]").click(function() {
            $("#ServerMsgContainer").slideUp();
            var validator = $("#ContactForm").validate({
                rules: {
                    name: { required: true },
                    company: { required: false },
                    phone: { required: true, minlength: 7, digits: true },
                    email: { required: true, email: true },
                    subject: { required: true }
                    //message: { required: true }
                },
                messages: {
                    name: errName,
                    phone: {
                        required: errPhone,
                        minlength: errPhone,
                        digits: errDigits
                    },
                    email: {
                        required: errorEmail,
                        email: errorEmail
                    },
                    subject: errSubject,
                    message: errMessage
                },
                submitHandler: AjaxSubmit
             
            }).form();
          
            $("#ContactForm").submit(); //$(this).closest('form').submit();
            if ($("#ContactForm").valid()) {
               setTimeout('top.location="URL TO DISPLAY TO THE USER"', 5000)
            }

        });
    });

  • Eran 292 posts 436 karma points
    Oct 12, 2010 @ 20:53
    Eran
    0

    thanks for sharing. maybe someone else will find it useful.

    BTY. if you like the project please vote for it on the main project page.

    Eran.

  • Peter Cort Larsen 421 posts 1038 karma points
    Oct 12, 2010 @ 20:56
    Peter Cort Larsen
    0

    Hi,
    a small change to my code:

    its better to add the redirect code to function 'AjaxSucceeded', that way the user only get redirected if everything goes well.

    See changes in bold.

    function AjaxSucceeded(result) {
        $('#ServerMsgHeader').html(thankYouHeaderText);
        $('#ServerMsgMessage').html(thankYouMessageText);

        $("#ServerMsgContainer").removeClass("emailFailure");
        $("#ServerMsgContainer").addClass("emailSuccess");

        $('#ServerMsgContainer').slideDown('slow');
        $('#ContactForm img.loader').fadeOut('fast', function() { $(this).remove() });
        $("#ContactForm #submit").attr('disabled', '');
        $('#ContactForm').slideUp('slow');

        //Redirect user to the specified page below                                                        
        if ( $("#ContactForm").valid()) {
                setTimeout('top.location="URL TO DISPLAY TO THE USER"', SECONDS TO WAIT REDIRECTING)
        }
        return
    }

  • Peter Cort Larsen 421 posts 1038 karma points
    Oct 12, 2010 @ 20:58
    Peter Cort Larsen
    0

    I will, but where on this page do i vote?
    'http://our.umbraco.org/projects/website-utilities/rvcontactform-multilingual-ajax-contact-form'

  • Eran 292 posts 436 karma points
    Oct 12, 2010 @ 21:03
    Eran
    0

    you are vote on the top right, where there is a number. you just click on it.

    another thing, in stackoverflow they suggest to use location.replace, did you see that?

  • Peter Cort Larsen 421 posts 1038 karma points
    Oct 13, 2010 @ 08:45
    Peter Cort Larsen
    0

    Yeah, i tried that, dosnt seem to work. Only top.location works .

Please Sign in or register to post replies

Write your reply to:

Draft