364,083 Members | 5803 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

How do I refresh target window?

sirshurf@gmail.com
P: n/a
sirshurf@gmail.com
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?

Oct 14 '05 #1
Share this Question
Share on Google+
10 Replies


nikki
P: n/a
nikki

sirshurf@gmail.com wrote:[color=blue]
> 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?[/color]

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);

Oct 14 '05 #2

Gérard Talbot
P: n/a
Gérard Talbot
nikki a écrit :[color=blue]
> sirshurf@gmail.com wrote:
>[color=green]
>>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?[/color]
>
>
> 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);
>[/color]

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
--
remove blah to email me
Oct 14 '05 #3

sirshurf@gmail.com
P: n/a
sirshurf@gmail.com
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...

Oct 14 '05 #4

sirshurf@gmail.com
P: n/a
sirshurf@gmail.com
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...

Oct 14 '05 #5

RobG
P: n/a
RobG
sirshurf@gmail.com wrote:[color=blue]
> 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();[/color]

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();
[color=blue]
>
> tmp.formName.submit();
>[/color]

tmp.document.forms['formName'].submit();
[color=blue]
>
>
> }
>
> On the chiled:
>
> function exit ()
> {
> //opener.document.form['new_entry'].submit();[/color]

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

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

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

[color=blue]
> self.opener.document.reload(true);
> close ();
> }
>
> The quoted is the one I used before...
>[/color]

Untested, but shoule be OK.


--
Rob
Oct 15 '05 #6

RobG
P: n/a
RobG
sirshurf@gmail.com wrote:
[...][color=blue]
> On the chiled:
>
> function exit ()
> {
> //opener.document.form['new_entry'].submit();[/color]

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

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


[...]

--
Rob
Oct 15 '05 #7

SirShurf
P: n/a
SirShurf
used: opener.document.forms['new_entry'].submit();

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

Help please...

Oct 15 '05 #8

SirShurf
P: n/a
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

Oct 15 '05 #9

RobG
P: n/a
RobG
SirShurf wrote:[color=blue]
> 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
>[/color]

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>


--
Rob
Oct 15 '05 #10

SirShurf
P: n/a
SirShurf
I ahve used your script... and thats what I got..

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

Oct 15 '05 #11

Post your reply

Help answer this question



Didn't find the answer to your JavaScript / Ajax / DHTML question?

You can also browse similar questions: JavaScript / Ajax / DHTML document refresh document. refresh