This task is resolved by using redirectToRoute
function.
To make form tag with submit doesn't open a new page/window [closed]
سؤال
So, there is an ordinary example of form
tag usage:
<form name="form_name" action="${url}" method="POST">`
<input type="text" name="email_input" id="email_input" class="input">
<input type="submit" name="send" class="send_ticket">
</form>
How can you see, I use Mako in action value and Python web framework CherryPy. So, this code works fine: I push the button, data is sent to a server then a new tab is opened. But I requares in no displaying a new tab in my browser. I want to stay on my current tab.
How can I do it? Thanks.
المحلول 2
نصائح أخرى
Since you completely changed your question, I am updating my answer.
By default, all form posts happen in the same browser window.
What you are describing seems as a very irregular behavior to me. Are you displaying the form in a popup such as colorbox or a jquery dialog and not mentioning it? or an iframe?
If not, you can try adding target="_self"
to your form markup, but note that it is being deprecated and will not be supported by all browsers.
<form name="form_name" action="${url}" method="POST" target="_self">`
<input type="text" name="email_input" id="email_input" class="input">
<input type="submit" name="send" class="send_ticket">
</form>
And lastly, you can try using Ajax to post the form data without forcing a new page load.
Here is a nice Tuts+ tutorial about Ajax form post.
Hope this helps!