FAQ Topic - How do I POST a form to a new window?

F

FAQ server

-----------------------------------------------------------------------
FAQ Topic - How do I POST a form to a new window?
-----------------------------------------------------------------------

You use the target attribute on the form, opening a window with
that name and your feature string in the onsubmit handler of the
FORM.

<form ... target="wndname" onsubmit="window.open('',this.target,'features');return true;">

http://www.htmlhelp.com/reference/html40/forms/form.html


===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.
 
E

Evertjan.

FAQ server wrote on 16 mei 2007 in comp.lang.javascript:
-----------------------------------------------------------------------
FAQ Topic - How do I POST a form to a new window?
-----------------------------------------------------------------------

You use the target attribute on the form, opening a window with
that name and your feature string in the onsubmit handler of the
FORM.

<form ... target="wndname"
onsubmit="window.open('',this.target,'features');return true;">

Just:

<form target = '_blank'>

will do fine. Look mam, no js!
 
A

ASM

Evertjan. a écrit :
FAQ server wrote on 16 mei 2007 in comp.lang.javascript:


Just:

<form target = '_blank'>

will do fine. Look mam, no js!

Without JS, anyway, that code will open another window than main one.

Giving a name to the target, on first call it will open a new window and
on next call(s) will load file(s) in this same new window (unlovely the
old new window passed behind the main one may cause user to meet some
difficulties to realize something happened somewhere)
 
E

Evertjan.

ASM wrote on 16 mei 2007 in comp.lang.javascript:
Evertjan. a écrit :

Without JS, anyway, that code will open another window than main one.

Giving a name to the target, on first call it will open a new window
and on next call(s) will load file(s) in this same new window

But that was not the subject of this FAQ-entry Q.

So the primary JS solution was wrong too.
(unlovely the
old new window passed behind the main one may cause user to meet some
difficulties to realize something happened somewhere)

Eh? Is this a cross browser issue?

Realizing that something happened somewhere is always a difficult task.

That something happened somewhere is a scientific certainty however
and a lovely certainty to the inquisitive mind at that.
 
A

ASM

Evertjan. a écrit :
ASM wrote on 16 mei 2007 in comp.lang.javascript:


But that was not the subject of this FAQ-entry Q.

no, only only (extended ?) subject of its answer :
- <form ... target="wndname"
- windox.open('','wndname','');
So the primary JS solution was wrong too.

Why ?
With that code, with/without JS, a blank window will really open (if the
user accepts popups), by extension the blank window can be a tab.
Eh? Is this a cross browser issue?

If you want to recall, you have to come back on the mother window (the
daughter, if not closed, moves in back and is not more seen).
When you recall (re submit) result comes in yet existing daughter which
stays behind, user will have to give back focus to her. Will he do it ?
Realizing that something happened somewhere is always a difficult task.

That something happened somewhere is a scientific certainty however
and a lovely certainty to the inquisitive mind at that.

:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top