0

My form when redirected to the thank you page after completion seems to retain all the data in the values field so if the user clicks back everything is there meaning they can just resubmit it and its super annoying.

if (emailSent) {
    Response.BufferOutput = true;
    Response.Redirect("MYDOMAIN/redirect.aspx");    
};

Above is where I redirect after the form has been submitted. For my code to pull the data I am using:

Request.Form[randomFormField]

When I redirect and then click back everything is there.

$(".submitBut").click(function() {
    $(this).closest('form').find("input[type=text], textarea").val("");
    window.location.href('MYREDIRECTDMAIN/redirect.aspx');
});

Above is another one of my attempts

I have tried a variety of different things and nothing seems to work. I need an ASP.NET solution or C# or JQuery.

braX
  • 11,506
  • 5
  • 20
  • 33
Kieranmv95
  • 828
  • 4
  • 14
  • 31

1 Answers1

1

Javascript on page load: clear all form fields

Uhm....

$(document).ready(function() {
    $(':input').val('');
});

References:

  1. Input
  2. Clearing
usr-local-ΕΨΗΕΛΩΝ
  • 26,101
  • 30
  • 154
  • 305