Copied to clipboard

Flag this post as spam?

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


  • Mathias 49 posts 193 karma points
    Oct 16, 2019 @ 15:13
    Mathias
    0

    MVC Form - how do I clear the fields on post?

    I have this normal MVC form on a page which i load using a Partial View. When the form is submitted I perform some backend logic, and after I'm done I do:

    return RedirectToCurrentUmbracoPage()
    

    But now the form fields aren't cleared. All the old values are still there. Is simple way for me to clear the fields?

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Oct 16, 2019 @ 15:24
    Bo Damgaard Mortensen
    0

    Hi Mathias,

    Strange, the RedirectToCurrentUmbracoPage() should indeed perform a redirect and thus clear the form. I think we need a little more context here to get to the solution.

    Can you paste the code for the controller method handling the post? :-)

    Thanks in advance.

    All the best,

    Bo

  • Mathias 49 posts 193 karma points
    Oct 17, 2019 @ 06:26
    Mathias
    0

    Ah, I see now that I've been using:

    return CurrentUmbracoPage()
    

    I'm gonna try and change to RedirectToCurrentUmbracoPage() and see if that works

  • Mathias 49 posts 193 karma points
    Oct 17, 2019 @ 06:27
    Mathias
    0

    That solved it :)

Please Sign in or register to post replies

Write your reply to:

Draft