passing values

V

vncntj

I have this home.js file and I'm trying to collect the values on the
other at "emplist.aspx"


function poponload()
{
testwindow= window.open ("emplist.aspx", "mywindow",
"location=1,status=1,scrollbars=1,width=600,height=600");
testwindow.moveTo(0,0);
}

document.write ("<form action=http://www.espn.com method=post>")
document.write ("<input type=text>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")

but I don't know how to retrieve the values in the emplist.aspx page.
the page opens but I can't retrieve the values.
 
B

brunascle.maps

I have this home.js file and I'm trying to collect the values on the
other at "emplist.aspx"

function poponload()
{
testwindow= window.open ("emplist.aspx", "mywindow",
"location=1,status=1,scrollbars=1,width=600,height=600");
testwindow.moveTo(0,0);

}

document.write ("<form action=http://www.espn.commethod=post>")
document.write ("<input type=text>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")

but I don't know how to retrieve the values in the emplist.aspx page.
the page opens but I can't retrieve the values.

not 100% sure what you mean, but it sounds like you're trying to get
two windows to talk to each other.

the original window has access to the window it opened via the
testwindow variable. the problem is, you dont really know when that
window is done loading, so you cant except code you put in the next
line after "testwindow= window.open..." to be working with the fully-
loaded emplist.aspx

what i usually do is have the window that popped tell the original
window that it's done loading. to do that, add this line of code after
the window.open():
testwindow.opener = window;

then the javascript code in your emplist.aspx page will have access to
the original window by using window.opener. so if you had a function
called foo() in your original file, your emplist.aspx file could call
that function by calling window.opener.foo()

you could either have emplist.aspx send data to the original file
through a parameter to a function like foo(), or you could just use
foo() as a sort-of checkpoint that tells the original file that
emplist.aspx is done loading and you can start getting data from it.
 
V

vncntj

thanks for responding...
I'm trying to pass.....

emplist.aspx?Fname=form.fname

to another page.

function poponload()
{
testwindow= window.open ("http://amp/emplist.aspx?Fname=form.fname",
"mywindow",
"location=1,status=1,scrollbars=1,width=600,height=600");
testwindow.moveTo(0,0);
}

document.write ("<form method=post>")
document.write ("<input type=text name=fname>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")
 
V

vncntj

Ok, I'm making some headway with

urlStr = "http://amp/emplist.aspx?Fname="+document.form.fname,
"mywindow","location=1,status=1,scrollbars=1,width=600,height=600";
function poponload()
{

testwindow= window.open (urlStr);
testwindow.moveTo(0,0);
}

document.write ("<form method=post>")
document.write ("<input type=text name=fname>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")


but I'm getting this.... "document.form.fname is null or not an
object!!!

Assistance???
Thanks,
 
L

Lee

(e-mail address removed) said:
Ok, I'm making some headway with

urlStr = "http://amp/emplist.aspx?Fname="+document.form.fname,
"mywindow","location=1,status=1,scrollbars=1,width=600,height=600";
function poponload()
{

testwindow= window.open (urlStr);
testwindow.moveTo(0,0);
}

document.write ("<form method=post>")
document.write ("<input type=text name=fname>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")


but I'm getting this.... "document.form.fname is null or not an
object!!!

I don't think you're really making much headway.
You're getting that error because document.form.fname doesn't exist
at the time that you're trying to concatenate it into your urlStr
variable. If it did exist, it wouldn't be a string, so it doesn't
really make any sense to try to append it to the URL, anyway.

Why are you using document.write() to create a form that doesn't
have any dynamic content? Why not just use simple HTML?

If the window that opens your emplist.aspx page contains a form
named "fname", then the emplist.aspx page can access that form as:
window.opener.forms["fname"]
You don't need to pass anything to the new page for that to work.
If you need to pass it the name of the form, then you need to pass
the *name*, not a reference to the form.


--
 
V

vncntj

The reason I'm using document.write() is because I'm using Team
Services to create these online resources and the only way to post
values from a form is to use JavaScript. The old fashion

<form>
<input type>
<input type=submit>

doesn't work.



http://blahblah/test.html?fname=
I keep getting undefined...
function poponload()
{

if (document.forms['fname'] != null)
{
urlStr = "http://192.168.14.13/test.html?
fname="+document.forms['fname'],
"mywindow","location=1,status=1,scrollbars=1,width=100,height=100";
}
else
{
urlStr = "http://192.168.14.13/test.html?
fname=1",
"mywindow","location=1,status=1,scrollbars=1,width=100,height=100";
}

testwindow= window.open (urlStr);
testwindow.moveTo(0,0);
}

document.write ("<form method=post>")
document.write ("<input type=text name=fname>")
document.write ("<input type=button value=Search onClick='javascript:
poponload()'>")
document.write ("</form>")
 
L

Lee

(e-mail address removed) said:
The reason I'm using document.write() is because I'm using Team
Services to create these online resources and the only way to post
values from a form is to use JavaScript. The old fashion

<form>
<input type>
<input type=submit>

doesn't work.



http://blahblah/test.html?fname=
I keep getting undefined...
function poponload()
{

if (document.forms['fname'] != null)
{
urlStr = "http://192.168.14.13/test.html?
fname="+document.forms['fname'],

Again, you do not want to append document.forms['fname'] to your URL.
You're trying to append a reference to the form where you seem to
want to append *the name* of the form.

After finally actually looking at your poponload() function,
it doesn't really make any sense. You're trying to create
urlStr as a triple of comma-separated values.

function poponload()
{
if (document.forms['fname'] != null)
{
urlStr = "http://192.168.14.13/test.html?fname="
+document.forms['fname'],
"mywindow",
"location=1,status=1,scrollbars=1,width=100,height=100";
}
else
{
urlStr = "http://192.168.14.13/test.html?fname=1",
"mywindow",
"location=1,status=1,scrollbars=1,width=100,height=100";
}
testwindow= window.open (urlStr);
testwindow.moveTo(0,0);
}

I suspect that what you really want is something like:

function poponload() {
window.open("http://192.168.14.13/test.html?fname=fname",
"mywindow",
"location,status,scrollbars,width=100,height=100"
+"screenX=0,screenY=0,resizable");
}


--
 

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,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top