Copied to clipboard

Flag this post as spam?

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


  • Dmitriy 168 posts 588 karma points
    Sep 07, 2018 @ 16:06
    Dmitriy
    0

    How to make safe form without BeginUmbracoForm() using?

    Hello, Umbracians.

    I want to create some forms and then submit data in async way to my SurfaceController, but I don't want to use a standard BeginUmbracoForm() method because It is not so understandeble for other team and frontend-developers.

    Here is my code:

    <form id="feedbackForm" action="@Url.SurfaceAction("HandleSubmitForm", "ContactForm")" method="post" enctype="multipart/form-data">
                @Html.AntiForgeryToken()
                <input type="text" name="name" value="nameValue" />
                <input type="email" name="email" value="[email protected]" />
                <input type="text" name="message" value="messageValue" />
                <button type="submit">Submit</button>
            </form>
    

    And script:

        $("#feedbackForm").on("submit", function (e) {
            e.preventDefault();
            $.ajax({
                type: "POST",                 
                data: $(this).serialize()                
            });
        });
    

    In this case I am not entering my ContactFormController, but getting a succesfull response with current page.

    Thanks

  • Dmitriy 168 posts 588 karma points
    Sep 07, 2018 @ 16:55
    Dmitriy
    100

    I found something in Umbraco Git, and it looks like I can't get a encrypted route because it is an internal method :(

Please Sign in or register to post replies

Write your reply to:

Draft