admin管理员组

文章数量:1325675

I am using Simple Form (getsimpleform) to email the HTML form contents to my email. The problem I am facing is that the HTML Form action is handled by getsimpleform so when the user clicks on submit button of the form, they are redirected to / but I want them to stay be redirected to another page (i.e. contact.html).

So I want the form action to be performed but at the same time, I want the user to be redirected to another web page.

Thanks.

I am using Simple Form (getsimpleform.) to email the HTML form contents to my email. The problem I am facing is that the HTML Form action is handled by getsimpleform so when the user clicks on submit button of the form, they are redirected to https://getsimpleform./ but I want them to stay be redirected to another page (i.e. contact.html).

So I want the form action to be performed but at the same time, I want the user to be redirected to another web page.

Thanks.

Share Improve this question edited Jun 6, 2017 at 9:28 Nirav Madariya 1,5082 gold badges24 silver badges38 bronze badges asked Jun 6, 2017 at 8:01 Masoom GilaniMasoom Gilani 692 gold badges2 silver badges10 bronze badges 3
  • change form's action attribute to your own's url – ZiTAL Commented Jun 6, 2017 at 8:05
  • 1 please show us your code – Gonras Karols Commented Jun 6, 2017 at 8:07
  • use ajax to send form data and change action="yourdomain./contact.html" – Nirav Madariya Commented Jun 6, 2017 at 8:16
Add a ment  | 

4 Answers 4

Reset to default 2

Just fill up your action attribute

<form action="next-page-please-url">
<button>butt</button>
</form>

You can add an action calback on your button, for example :

in yout HTML

<form>
...
<input type="submit" onclick="redirect()">
</form>

and in your javascript :

var redirect = function(){
   document.location.href="contact.html"
}

First of all you need to change the action url of the form to your domain name

From

action="https://getsimpleform./"

To

action="https://YourDomain./"

and then on your php or whatever server side language you are using you can redirect e.g. I will use php example.

header('Location: http://www.YourDomain./OtherPage');

Based on their official page remendation on redirect

  <input type='hidden' name='redirect_to' value='https://yourdomain./contact.html' />

Try to insert it into the form and see whether it solves your problem.

P.S. don't forget to change [yourdomain] to your actual domain.

本文标签: javascriptHow to redirect to another page after form actionStack Overflow