How do I refresh target window?

S

sirshurf

hello all:

I have a pop up window is for the user to submit some information.
That window is refreched a few times with the user inputs (its a form
submit in itself... couple of times). I would like that window to close
after the user submits a rating and refreshed the original page that
opened the window.

I cant use opener.document.refresh because afterall the page isnt
considered the opener after the user posts the information on the pop
up window.

am i making any sense?
 
N

nikki

hello all:

I have a pop up window is for the user to submit some information.
That window is refreched a few times with the user inputs (its a form
submit in itself... couple of times). I would like that window to close
after the user submits a rating and refreshed the original page that
opened the window.

I cant use opener.document.refresh because afterall the page isnt
considered the opener after the user posts the information on the pop
up window.

am i making any sense?

Yes, but it is the same window, and it's the window that cares. At
least, in theory. :)

And it's reload, not refresh.

Give it a shot.

self.opener.document.reload(true);
 
G

Gérard Talbot

nikki a écrit :
Yes, but it is the same window, and it's the window that cares. At
least, in theory. :)

And it's reload, not refresh.

Give it a shot.

self.opener.document.reload(true);

reload is a location method, not a document method.
And what the original poster needs, I am pretty sure he does not need to
reload the opener.

Gérard
 
S

sirshurf

Nop Not Working....

My code is (for the reference...)

On teh parent:

function newwindow(url) {


newwindow2=window.open('','CallMePopUp','status=no,scrollbars=yes');
var tmp = newwindow2.document;
tmp.write('<html><head><title></title>');
tmp.write('</head><body><form name="formName" method="post"
action="calc.php">');
tmp.write('<input type="hidden" name="prodh" value="bred">');
tmp.write('</form>');
tmp.write('</body></html>');
tmp.close();

tmp.formName.submit();



}

On the chiled:

function exit ()
{
//opener.document.form['new_entry'].submit();
self.opener.document.reload(true);
close ();
}

The quoted is the one I used before...
 
S

sirshurf

You are right... I really need to post some information to teh opener,
and THAN to reload it ... or better tu SUBMIT in it...

but I cannt... at least I dont know how...
 
R

RobG

Nop Not Working....

My code is (for the reference...)

On teh parent:

function newwindow(url) {


newwindow2=window.open('','CallMePopUp','status=no,scrollbars=yes');
var tmp = newwindow2.document;
tmp.write('<html><head><title></title>');
tmp.write('</head><body><form name="formName" method="post"
action="calc.php">');
tmp.write('<input type="hidden" name="prodh" value="bred">');
tmp.write('</form>');
tmp.write('</body></html>');
tmp.close();

I think that will be a bit nicer as:

tmp.document.write(
'<html><head><title></title>'
+ '</head><body><form name="formName"'
+ 'method="post">action="calc.php">'
+ '<input type="hidden" name="prodh" value="bred">'
+ '</form>'
+ '</body></html>'
);
tmp.document.close();
tmp.formName.submit();

tmp.document.forms['formName'].submit();



}

On the chiled:

function exit ()
{
//opener.document.form['new_entry'].submit();

-----------------------------^

I take it you are aftert he *forms* collection?

opener.document.forms['new_entry'].submit();

self.opener.document.reload(true);
close ();
}

The quoted is the one I used before...

Untested, but shoule be OK.
 
R

RobG

On the chiled:

function exit ()
{
//opener.document.form['new_entry'].submit();

opener.document.forms['new_entry'].submit();

----------------------------^


[...]
 
S

SirShurf

used: opener.document.forms['new_entry'].submit();

Still not working... the parent window is not refreshin or submiting...

Help please...
 
S

SirShurf

I have opened FireFox that gives a better JS concole... and I am
getting

Error: opener.document.new_entry.submit is not a function
Source File:
Line: 47
 
R

RobG

SirShurf said:
I have opened FireFox that gives a better JS concole... and I am
getting

Error: opener.document.new_entry.submit is not a function
Source File:
Line: 47

That means that the form new_entry doesn't exist as far as the function
is concerned (it may actually be in the page).

Try the following:

<html><head><title>Child play</title>
</head><body>

<script type="text/javascript">

function newWin(url) {
newWin2=window.open('','CallMePopUp','');
var tmp = newWin2.document;
tmp.write(
'<html><head><title></title>',
'</head><body><form name="formName" action="">',
'<input type="text" name="prodh" value="bred">',
'<input type="submit">',
'</form>',
'<input type="button" value="Submit parent form" onclick="',
' window.opener.document.forms[\'new_entry\'].submit();',
'window.close();',
'">',
'</body></html>'
);
tmp.close();
}

</script>
<input type="button" value="Open child" onclick="newWin();">
<form name="new_entry" action="">
<input type="text" name="blah" value="afasdf">
<input type="submit">
</form>

</body></html>
 
S

SirShurf

I ahve used your script... and thats what I got..

Error: window.opener.document.forms.new_entry has no properties
 

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
474,266
Messages
2,571,081
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top