Re: JSModalWindow Close and Refresh Question
Re: JSModalWindow Close and Refresh Question
- Subject: Re: JSModalWindow Close and Refresh Question
- From: Jonathan Rochkind <email@hidden>
- Date: Wed, 31 Mar 2004 11:53:10 -0600
There are probably a bunch of ways to do that. I don't know why what
you are doing didn't work, I'd think it would too. You'd have to
debug it, make some sample HTML/Javascript pages, see how different
browsers deals with them. Oh wait, an image submit button? I think
image submit buttons frustratingly don't support onClick, if I'm
remembering right. But maybe I'm not. You'd just have to play around
with it.
Another way to do it: Have your link be a simple WOHyperlink or
dynamic submit button, bound to an action method. But that action
method returns a WOComponent (or WOResponse) which is simply HTML
that says:
<SCRIPT LANGUAGE=Javascript>opener.refresh(); window.close();</SCRIPT>
Or something like that. Makes a trip to the server, action method is
called, sends back HTML containing javascript to close the window,
first doing other javascript stuff if you want. Warning: "opener" may
not work on old browsers. Also consider: Instead of just calling
javascript refresh() on the opener window, would it be better to load
a URL in the opener window for a particular action method? That can
be done. Whether it's preferable or not depends on your situation,
you can decide yourself.
--Jonathan
At 11:32 AM -0600 3/31/04, James Cicenia wrote:
I guess my problem is how to approach the fact that my submit image
button does some work...
i.e., sets some values and of course ec.saveChanges(). Then I want
it to close and of course refresh
the parent window. It seems I can do either but not both.
How do you do it?
-James
On Mar 31, 2004, at 11:02 AM, Jonathan Rochkind wrote:
I think "window.close();" is what you want, not "self.close();"
although I'm no javascript expert (I know just enough to get by,
and research how to do things as they come up. The Javascript FAQ
at www.irt.org is very valueable for 'recipes' of how to do certain
things in javascript, from simple to complex).
I don't see any reason why the onclick shouldn't work, but when I
want a hyperlink that _only_ executes javascript, and does not
actually load a URL, I personally use a different idiom:
href="javascript: someJavascirpt(); return void 0;"
That has always worked better for me than messing with onclick---I
use onclick only if I want some javascript to happen upon click,
but ALSO want a URL loaded.
As far as your other question: I can't see any reason why
JSModalWindow shouldn't be in a WORepetition. On my machine (which
is WO 5.2.1, though), I don't get a WOBuilder validation error from
doing this. What is the specific text of the validation error WO
gives you? Regardless, it is sometimes okay to just ignore
WOBuilder validation errors, when it gets things wrong, and see if
it works at runtime anyhow.
At 9:19 AM -0600 3/31/04, James Cicenia wrote:
Hello -
I am a bit confused on bit of JSModalWindow...
On the calling page I have an action that does the usual
nextPage assignment with some initializations and my
window pops up perfectly. Upon cancel I do a
onClick binding with "self.close();";
However I can't seem to figure out how to close the window
on my submit button. It does perform my submits action method,
i.e., it update the database, but it doesn't close the window!?
I have tried binding onClick = "opener.refresh();self.close();";
and
onClick = "self.close();opener.refresh();";
but it neither closes the window or refreshes the window. Any
thoughts here ?
Thanks
-James Cicenia
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.