Click to See Complete Forum and Search --> : Form Submission and size Problem in Netscape 6.0


sachin
03-06-2003, 04:44 PM
Hi,

I want to submit to testadv.asp from test.htm through a link and it has to be a submit and open testadv.asp in a new window with fixed size say width=300 and height=500.
The below code submits through a link and opens in new window(But not i size i want) and works only in IE 6.0 and Netscape 7.0.

I want it work in Netscape 6.0 also and it should open with a fixed size and i should be able to retrieve the submitted value in testadv.asp.

Pl look at the code below.

<html>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">


function createTarget(surl) {
document.Form1.email.value=surl;
document.Form1.action="testadv.asp";
document.Form1.submit();
//return true;
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<center>
Form Target
<p>

<!-- Special Notes: -->
<!-- Simply begin the target attribute with a name of your -->
<!-- choice, _blank, _top, etc... followed by a colon and -->
<!-- the window options string used in the window.open -->
<!-- command. Anything in this string enclosed in { and } -->
<!-- will be interpreted as JavaScript. -->

<form action="" method="post" name="Form1" target=_blank"">
<table align=center >
<tr><td align=right>Name:</td>
<td><input name=name></td></tr>
<tr><td align=right>Email:</td>
<td><input name=email ></td></tr>
<tr><td align=right>Favorite Color:</td>
<td><input name=fav_color ></td></tr>
<tr><td align=center colspan=2><a href ="javascript:createTarget(document.Form1.email.value);" >Link</a></td></tr>
</table>
</form>
</center>


</html>

Jona
03-06-2003, 05:09 PM
Just curious about this line...

<form action="" method="post" name="Form1" target=_blank"">

Is that supposed to be, <form action="" method="post" name="Form1" target="_blank"> ?

Oh, back to your question. Let's see, you have target="_blank" shouldn't you use javascript for window.open('','') in your function instead? That would probably definitely work, although I don't often script for NN6.

sachin
03-06-2003, 05:20 PM
You are right.

this was supposed to be <form action="" method="post" name="Form1" target="_blank"> ...


I cannot use window.open as I need to post the values instead of doing a get request.

Actually my requirement is to post a form, and post form action should open a new window with fixed size.Please let me know if it can be done in any other ways

Jona
03-06-2003, 05:26 PM
But can't you just do this....?

<html>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function createTarget(surl) {
newWin = window.open("","newWin","width=300,height=300");
newWin.document.write("<HTML><HEAD><TITLE>Your title</TITLE>");
newWin.document.write("<!--Add your etc. tags to make it look like whatever you want it to look like -->");
newWin.document.write("<h1>"+surl+"</h1>");
newWin.document.write("<b>"+document.Form1.name1.value);
newWin.document.write(document.Form1.fav_color1.value+"</b>");
document.Form1.email.value=surl;
document.Form1.action="testadv.asp";
document.Form1.submit();
}
</script>
</HEAD>
<BODY>
<center>
Form Target
<p>
<form action="" method="post" name="Form1" target="newWin">
<table align=center >
<tr><td align=right>Name:</td>
<td><input name=name1></td></tr>
<tr><td align=right>Email:</td>
<td><input name=email></td></tr>
<tr><td align=right>Favorite Color:</td>
<td><input name=fav_color1></td></tr>
<tr><td align=center colspan=2><a href="javascript:createTarget(document.Form1.email.value);">Link</a></td></tr>
</table>
</form>
</center>
</html>


Hey, I editted the code. Tell me if you like this.

sachin
03-06-2003, 06:27 PM
Jona,

Thanks a Lot .
It works.

but the lines gave some problem, i commented it out and it worked.

newWin.document.write"<b>"+document.Form1.name1.value);
newWin.document.writedocument.Form1.fav_color1.value+"</b>");



By the way i have another problem, whenever i try to
document.formname.submit()
in netscape 6.0 , I Get a
"Object is not a function" Error.

Let me know .

Thanks Once again.

Jona
03-06-2003, 09:53 PM
Ewww, sorry, I don't script for NN6 often. Let me think. I'll let you know if I come up with an answer. My first guess is that it's not recognizing it as a function to execute. In short, you'll have to find some kind of reference that tells you what to use instead for NN6. Try www.irt.org