Z
ZazuMC
Hi all. I've got a form that I submit to a new window using the
following
code:
function sendMe() {
var w = window.open("custsearch.asp", "myNewWin", "width=550,
height=300");
document.form1.target = 'myNewWin';
document.form1.action="custsearch.asp";
document.form1.submit();
document.form1.reset();
return true;
}
What this does is open a search in a new window, that then hits the
database
with the search criteria and returns the results. Then, I click on
the
results in that window to populate the form fields on the initial
window, then
close the popped up window with this code:
function subMe(val) {
if (val == 2) {
opener.document.form1.reset();
opener.document.form1.fname.value = "<%= fname %>";
opener.document.form1.lname.value = "<%= lname %>";
opener.document.form1.address1.value = "<%= address1 %>";
opener.document.form1.address2.value = "<%= address2 %>";
opener.document.form1.city.value = "<%= city %>";
opener.document.form1.state.value = "<%= state %>";
opener.document.form1.zip.value = "<%= zip %>";
opener.document.form1.phone1.value = "<%= phone1 %>";
opener.document.form1.email.value = "<%= email %>";
window.close();
}
}
Now, all this works great. But, when I go to submit the form on the
initial
window, it wants to open a new window every time and I haven't figured
out how
to get around that. It's almost like it is not resetting the "target"
value
for where the form is to be submitted. The submit buttons are all
defined as button, not submit, so I call a function to actually submit
the final form.
function subFrm() {
document.form1.action = "nextpage.asp";
document.form1.submit();
return false;
}
This is called with the following:
<input type="button" name="subButton" id="subButton" value="Continue
Can someone help me out here please?
Thanks!
following
code:
function sendMe() {
var w = window.open("custsearch.asp", "myNewWin", "width=550,
height=300");
document.form1.target = 'myNewWin';
document.form1.action="custsearch.asp";
document.form1.submit();
document.form1.reset();
return true;
}
What this does is open a search in a new window, that then hits the
database
with the search criteria and returns the results. Then, I click on
the
results in that window to populate the form fields on the initial
window, then
close the popped up window with this code:
function subMe(val) {
if (val == 2) {
opener.document.form1.reset();
opener.document.form1.fname.value = "<%= fname %>";
opener.document.form1.lname.value = "<%= lname %>";
opener.document.form1.address1.value = "<%= address1 %>";
opener.document.form1.address2.value = "<%= address2 %>";
opener.document.form1.city.value = "<%= city %>";
opener.document.form1.state.value = "<%= state %>";
opener.document.form1.zip.value = "<%= zip %>";
opener.document.form1.phone1.value = "<%= phone1 %>";
opener.document.form1.email.value = "<%= email %>";
window.close();
}
}
Now, all this works great. But, when I go to submit the form on the
initial
window, it wants to open a new window every time and I haven't figured
out how
to get around that. It's almost like it is not resetting the "target"
value
for where the form is to be submitted. The submit buttons are all
defined as button, not submit, so I call a function to actually submit
the final form.
function subFrm() {
document.form1.action = "nextpage.asp";
document.form1.submit();
return false;
}
This is called with the following:
<input type="button" name="subButton" id="subButton" value="Continue
" onClick="return subFrm()">
Can someone help me out here please?
Thanks!