use of <form method="head"

admin

Administrator
Staff member
Hi!<br />
<br />
I would like to program a LogIn facility, where the user goes directly from the LogIn page to the first page in a NEW WINDOW (Window.Open()). So I have to write 3 files. The LogIn file, the file checking for user name and password and (redirect to) the first page. I tried with a JavaScript containing<br />
<br />
action="window.open(...)"<br />
<br />
and it actually worked. A new window was created, BUT the values from the LogIn form was lost on the way from the browser to the server!<br />
<br />
Saving the LogIn variables to Session variables (in the middle file) showed (in the 3. file), that the variable names had been transferred, but their values were empty.<br />
<br />
Can anybody telle me, what happens, and can I program around it? and how?<br />
<br />
It works with action="check.asp", but of course without the new window, and with target="_blank" it goes wrong again.<br />
<br />
puzzeled but kind regards<br />
Torben<!--content-->When people log onto my web site, I want the first page after the login page to be in a new window. So they can just close the window, and they are back to the login page.<br />
<br />
It's easy to show a page in a new window. I used window.open(...) to do it. The problem is, that after a login page, I have to let asp check username and password, and asp cannot tell the browser to show the next page in a new window (as far as I know).<br />
<br />
Since I do not want an intermediate browser page after my login page, I tried - in the form tag of the login page - to write, at first:<br />
<br />
action="window.open('check.asp',...)"<br />
<br />
and then instead:<br />
<br />
action="check.asp" target="_blank"<br />
<br />
hoping, that the file redirected by check.asp (called menu.asp) would show in a new window. In both cases it did, but the password and username were not recognized. <br />
<br />
I then saved username and password in session variables, and read all session variables in meu.asp. It turned out, that the variable names were tranferred, but their values were blank. Using only<br />
<br />
action="check.asp"<br />
<br />
transferred both variables and values. Hence my mystification :-)<br />
<br />
Maybe it's untraditional to force the redirected file into a new window. This made me consider another approach:<br />
<br />
Actually ther are (proposed?) 8 different values to the method parameter of the form tag. Besides the well known get and post there is the value HEAD, that only returns the header of the HTML response, and no body. This was, what I needed (?).<br />
<br />
If I use <br />
<br />
method="head"<br />
<br />
and the check.asp returned nothing, I would not get a new page. And if I could be notified, that the header has arrived, I could react to an event (something like onHeader) with the javaScript statement<br />
<br />
onHeader="window.open(menu.asp,...)"<br />
<br />
But. My browsers (IE 5.0 and Netscape 4.7) waited for a response anyway. So either method="head" is not implemented in the browsers, or the server is not sending a header. I the latter is true, I would like to know:<br />
<br />
- what can I do to have the server return a header? Is it not enough not to use response.redirect ... Will response.End do the job, or what?<br />
<br />
- how am I notified, that the header has arrived, through a javaScript event or what?<br />
<br />
- Or is there another way to solve the problem?<br />
<br />
This is a lot of fuzz just to avoid a white page in peoples browsers, but I never see such pages on the internet, and it would look unprofessionel. That's why...<br />
<br />
Greetings Torben<!--content-->Hi Dave and thank you!<br />
<br />
So the problem was because I use an check.asp file, if I understand you right.<br />
<br />
I will avoid that. I hope, I can come back, if it doesn't work:-)<br />
<br />
Greetings Torben<!--content-->Hi Dave<br />
<br />
So, I will!<br />
<br />
Yesterday I tried to use the model<br />
<br />
<form ... action="menu.asp" target="_blank" ... ><br />
<br />
and, as you said, it worked! Now, my problem is, that I want the new window to be full screen and without the toolbars. IE displays the toolbars in a small window, and Netscape displays the toolbars in a maximied window, so target=_blank" is not good enough.<br />
<br />
I could use<br />
<br />
window.open("menu.asp",...)<br />
<br />
with appropriate parametres, but the <form> tag wil not recognize action="JavaScript:newPage()" as a URL.<br />
<br />
An alternative solution would be to submit the form back to login.asp, as you also suggested, but that would result in two neigboring pages containing login.asp in the users browser. And action="JavaScript:Reload" won't work.<br />
<br />
So, we are back to the original problem: <b>can I submit a form to an asp-script, without receiving a new page?</b> And can I be notified, that the script is done on the server?<br />
<br />
I'm pretty sure, that <br />
<br />
<form method="head" ... ><br />
<br />
is a valid attribute for the form tag, since it is documented in the http 1.1 documentation on w3c.com as a MUST. And my asp book says, that it works like method="get", only it doesn't return a http body, just the header (hence the name).<br />
<br />
Maybe I have to change my plans according to the possibilities, but I don't feel sure yet, tht they are impossible. And I just hate to give up!<br />
<br />
My design idea is simple: First page is login page and no more in that window. The rest of the pages are shown in a new maximized and toolbar-free window, each with a Quit button to close the window and return to the login page.<br />
<br />
It must be possible?<br />
<br />
Greetings Torben<br />
(sorry about my temper)<!--content-->Whowie<br />
<br />
I'll try that (but isn't onSubmit done before submitting?)<br />
<br />
I'll try anyway<br />
<br />
Torben :-)<br />
<br />
PS<br />
Sorry,Dave, the thread broke :-)<!--content-->Hi Dave (and others)<br />
<br />
Oh yes, that was the point, indeed!<br />
<br />
I have tried your suggestion (with other names):<br />
<br />
<form name="frmLogin" method="POST" action="Tjek1.asp" target="_blank" onSubmit="var ptr = window.open('', this.frmLogin.target,'menubar=0');return true;"><br />
<br />
It is ingenious. First executing the onSubmit, that opens a window with the name this.frmLogin.target. Then submitting the form to Tjek1.asp in the targetwindow defined by target="_blank". This window gets a name, that can be referenced by this.target.<br />
<br />
(The change of this.target to this.frmLogin.target is my invention. It didn't work without it :-))<br />
<br />
Thanks a million times.<br />
<br />
Greetings Torben<!--content-->Hi Dave and friends<br />
<br />
Checking the windows more thoroughly I saw, that even though there was only one window instead of two (onSubmit and target), the features werw not in effect in the new window. The reason must be, that the window name was defined by 'target= window' and not by the 'onSubmit= window'.<br />
<br />
The solution was to define the window name in window.open('','win1',...) and then write that name in target="win1". Now the window comes without the toolbars and in a proper size! Try it out, if you like :-)<br />
<br />
<form name="frmLogin" method="POST" action="Tjek1.asp" target="win1" <br />
onSubmit="var ptr=window.open('','win1','menubar=0,left=0,top=0,width='+(screen.width-10)+',height='+(screen.height-10));return true;"><br />
<br />
I still have a problem, though.<br />
<br />
If I don't want to use a 1024x768 blank page to write 'Username or password is not recognized', I stille have to branch out:<br />
<br />
1: To reload my login page, if username or password is wrong, or<br />
<br />
2: To show the menu in the new window, if username and password is correct<br />
<br />
which, I beleive, brings us back to the original headline: use of <form method="HEAD" ...<br />
<br />
I think, I have to do som experimenting and some searching, and it will take some weeks, before I can contribute to the thread (thanks for mending it, by the way).<br />
<br />
Greetings Torben<br />
<br />
(last night the file didn't work, but now the same file works,<br />
If you want to test, it's on<br />
<br />
<!-- m --><a class="postlink" href="http://www.amtrup.dk/asp/Default.asp">http://www.amtrup.dk/asp/Default.asp</a><!-- m --><br />
<br />
password is unimportant, and the redirected file (Fuld2.asp) is loading another window with the file Men1.asp. This is just for testing.<br />
<br />
When it goes wrong, IE 5.0 shows Fuld2.asp in a normalized window with toolbars. When it is ok, the page is shown in a full screen window without toolbars.<!--content-->
 
Back
Top