[Seaside] Re: Open URL in new window

Philippe Marschall philippe.marschall at gmail.com
Sun May 24 14:45:30 UTC 2009

2009/5/24 Paul DeBruicker <pdebruic at gmail.com>:
> Thanks Phillipe.  It is not my intention to distract or surprise them.
>  I think I'm actually trying to create a convenience feature.  One of
> the things I'm trying to accomplish is a form where you put in a
> ticker for a stock or mutual fund, and once you click submit it opens
> the research reports on websites such as finance.google.com or
> finance.yahoo.com or whichever and however many sites the user chooses
> in a multiselect on my form.

I see, that's a very different use case from what I had in mind. In
this case a popup is IMHO one of the best options.

> I know I could wrap those companies
> content up in an iframe or lightbox or whatever but right now I'd
> prefer to just open a new browser window for each report requested and
> be done with it.
> I've now looked into the guts of the popupAnchor and see that it
> catches the onClick event and calls the JS window.open() etc.  I don't
> know enough javascript yet to know whether and how I can feed the
> dynamically generated URLs to that function.

That's a good occasion to learn it then ;-) Look at it as a
programming language to learn like Self, Scheme or Ruby.

1. Use an anchor with target="_blank". That's a semantic HTML
violation but works better with tabbed browsing (you actually want to
open a tab, not a window).
2. Create the form with the element names matching the parameter names
of the target url
3. Set the URL of the anchor to the base URL of the target website
4. add an onclick handler, use Prototype to serialize the form [1]
append it to the anchor URL. Return true, this will cause the browser
to open the URL.

[1] http://www.prototypejs.org/api/form/serialize


More information about the seaside mailing list