-1

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.

Dmitriy_Cert
  • 157
  • 1
  • 12

2 Answers2

1

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!

dev7
  • 6,259
  • 6
  • 32
  • 65
  • Thank you for your answer, but `target = "_blank"` means: _The response is displayed in a new window or tab_. But I need to not displaying new tab or window. – Dmitriy_Cert Jan 29 '14 at 08:27
  • So you need it in the same page??? that's the default...I'm confused as what you were asking then – dev7 Jan 29 '14 at 08:30
  • I updated the post. So, there is an inverse task. A new tab is always displayed and I don't need it. I want to stay on my current tab (where is the button) – Dmitriy_Cert Jan 29 '14 at 08:43
  • @Dmitriy_Cert I revised my answer. – dev7 Jan 29 '14 at 10:22
  • It's my mistake, I didn't say that I use Python web framework Cherrypy and my problem is resolved by using `redirectToRoute` function. @Yani Thank you for your answer nevertheless. – Dmitriy_Cert Jan 29 '14 at 11:38
0

This task is resolved by using redirectToRoute function.

Dmitriy_Cert
  • 157
  • 1
  • 12