Re: target _blank *and* refresh original page
Michael Sharp <[email protected]> Thu, 1 Sep 2011 13:20:37 +1000
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============2023578948==
Content-Type: multipart/alternative;
boundary="Apple-Mail=_791D3538-6026-4D35-AE51-54D23C7F806D"
--Apple-Mail=_791D3538-6026-4D35-AE51-54D23C7F806D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
There's probably a much simpler way that I'm missing, but anyway:
unless there's a reason for not opening the new window with javascript =
then your action method could return context.page (i.e. refresh) while =
also setting some flag, e.g. set a boolean willOpenWindow =3D true=20
Then appendToResponse can do something like the following in =
willOpenWindow =3D=3D true cases=20
=
response.appendContentString("<script>window.open('computed.somehow',null,=
null,null);</script>");
Sharpy..
On 01/09/2011, at 11:54 AM, Ond=C5=99ej =C4=8Cada wrote:
> Hello there,
>=20
> seems a rather usual task, but I can't find a decent solution nor =
google out one.
>=20
> I've got a WOHyperlink which returns something (through WORedirect, =
though I don't think that's important) in a new window -- i.e., I've set =
target=3D_blank in the WOHyperlink bindings.
>=20
> The trick is that I would need to refresh the original page too: my =
code looks more or less this way
>=20
> String theResult; // bound to a WOString in the page
> WOActionResults showFooInExtraPage() { // bound to a target=3D_blank =
WOHyperlink
> WORedirect wor=3Dnew WORedirect(context());
> wor.setUrl( ... computed somehow, irrelevant, works all right ...);
> theResult=3D"Thanks for getting "+wor.url();
> return wor;
> }
>=20
> How to make the original page to reflect the new theResult value =
automatically without waiting till the user does something to refresh it =
manually?
>=20
> About the best I can think of is to refresh the page all the time, but =
that would be *quite* ugly and inconvenient -- the user might not use =
the WOHyperlink at all, and it would seem highly weird to have the page =
refresh all the time without apparent reason :/
>=20
> Thanks a lot,
> ---
> Ondra =C4=8Cada
> OCSoftware: [email protected] http://www.ocs.cz
> private [email protected] http://www.ocs.cz/oc
>=20
>=20
>=20
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
--Apple-Mail=_791D3538-6026-4D35-AE51-54D23C7F806D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=utf-8
<html><head></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; =
"><div>There's probably a much simpler way that I'm missing, but =
anyway:</div><div><br></div><div>unless there's a reason for not opening =
the new window with javascript then your action method could return =
context.page (i.e. refresh) while also setting some flag, e.g. set a =
boolean willOpenWindow =3D true </div><div><br></div><div>Then =
appendToResponse can do something like the following =
in willOpenWindow =3D=3D true cases </div><div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: =
rgb(58, 51, 254); "><span style=3D"color: =
#000000">response.appendContentString(</span>"<script>window.open('c=
omputed.somehow',null,null,null);</script>"<span style=3D"color: =
#000000">);</span></div></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal =
normal normal 11px/normal Monaco; color: rgb(58, 51, 254); "><span =
style=3D"color: #000000"><br></span></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal =
normal normal 11px/normal Monaco; color: rgb(58, 51, 254); "><span =
style=3D"color: =
#000000">Sharpy..</span></div><div><br></div><br><div><div>On =
01/09/2011, at 11:54 AM, Ond=C5=99ej =C4=8Cada wrote:</div><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div>Hello =
there,<br><br>seems a rather usual task, but I can't find a decent =
solution nor google out one.<br><br>I've got a WOHyperlink which returns =
something (through WORedirect, though I don't think that's important) in =
a new window -- i.e., I've set target=3D_blank in the WOHyperlink =
bindings.<br><br>The trick is that I would need to refresh the original =
page too: my code looks more or less this way<br><br>String theResult; =
// bound to a WOString in the page<br>WOActionResults =
showFooInExtraPage() { // bound to a target=3D_blank WOHyperlink<br> =
WORedirect wor=3Dnew WORedirect(context());<br> wor.setUrl( =
... computed somehow, irrelevant, works all right ...);<br> =
theResult=3D"Thanks for getting "+wor.url();<br> return =
wor;<br>}<br><br>How to make the original page to reflect the new =
theResult value automatically without waiting till the user does =
something to refresh it manually?<br><br>About the best I can think of =
is to refresh the page all the time, but that would be *quite* ugly and =
inconvenient -- the user might not use the WOHyperlink at all, and it =
would seem highly weird to have the page refresh all the time without =
apparent reason :/<br><br>Thanks a lot,<br>---<br>Ondra =
=C4=8Cada<br>OCSoftware: <a =
href=3D"mailto:[email protected]">[email protected]</a> =
&n=
bsp; <a href=3D"http://www.ocs.cz">http://www.ocs.cz</a><br>private =
<a =
href=3D"mailto:[email protected]">[email protected]</a> =
<a=
=
href=3D"http://www.ocs.cz/oc">http://www.ocs.cz/oc</a><br><br><br><br>____=
___________________________________________<br>WebObjects-dev mailing =
list<br><a =
href=3D"mailto:[email protected]">[email protected]<=
/a><br>http://www.omnigroup.com/mailman/listinfo/webobjects-dev<br></div><=
/blockquote></div><br></body></html>=
--Apple-Mail=_791D3538-6026-4D35-AE51-54D23C7F806D--
--===============2023578948==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
--===============2023578948==--