Open URL in new window

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Open URL in new window

Paul DeBruicker
Hi

After clicking a button I'd like to do generate a URL and then open
that URL in a different window.  I can generate the URL, but don't
know how to open the URL in another window without using the
popupAnchor tag.  I'd prefer to not have to display the anchor and ask
for another click if possible.  Is there a way to do this?  Thanks

renderContentOn: html
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Open URL in new window

Paul DeBruicker
I hit send prematurely.  The URL I generate has nothing to do with my
seaside application.  E.G. The user chooses between Google and Yahoo
in a select tag element then hits submit.  I then open a new window
that displays www.google.com or www.yahoo.com and switches their focus
to that.


Thanks in advance and let me know if an example would help.


Paul

On Fri, May 22, 2009 at 5:58 PM, Paul DeBruicker <[hidden email]> wrote:

> Hi
>
> After clicking a button I'd like to do generate a URL and then open
> that URL in a different window.  I can generate the URL, but don't
> know how to open the URL in another window without using the
> popupAnchor tag.  I'd prefer to not have to display the anchor and ask
> for another click if possible.  Is there a way to do this?  Thanks
>
> renderContentOn: html
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Open URL in new window

Randal L. Schwartz
>>>>> "Paul" == Paul DeBruicker <[hidden email]> writes:

Paul> I hit send prematurely.  The URL I generate has nothing to do with my
Paul> seaside application.  E.G. The user chooses between Google and Yahoo
Paul> in a select tag element then hits submit.  I then open a new window
Paul> that displays www.google.com or www.yahoo.com and switches their focus
Paul> to that.

I think you're supposed to use CSS for that, but the non-CSS way is:

  html anchor newTarget url: '...'; with: 'anchor text'.

The "newTarget" puts <a href target="_new" ...>...</a>, which all modern
browsers respect as "open in new window".

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Open URL in new window

Stefan Schmiedl
On Fri, 22 May 2009 15:45:26 -0700
[hidden email] (Randal L. Schwartz) wrote:

> >>>>> "Paul" == Paul DeBruicker <[hidden email]> writes:
>
> Paul> I hit send prematurely.  The URL I generate has nothing to do
> Paul> with my seaside application.  E.G. The user chooses between
> Paul> Google and Yahoo in a select tag element then hits submit.  I
> Paul> then open a new window that displays www.google.com or
> Paul> www.yahoo.com and switches their focus to that.
>
> I think you're supposed to use CSS for that, but the non-CSS way is:
>
>   html anchor newTarget url: '...'; with: 'anchor text'.

The OP was asking opening a new window after hitting a submit
*button* in a form, as far as I understood.

>
> The "newTarget" puts <a href target="_new" ...>...</a>, which all
> modern browsers respect as "open in new window".
>

... named "_new". If another anchor targets "_new", that
same window will be *reused*.

To really create a new window every time, use target="_blank"

s.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Open URL in new window

Paul DeBruicker
I think I don't understand what to do with Randal's suggestion.  Do I
put in the callback of the form submit button like this:

html submitButton
      callback:[html anchor newTarget url: (self
createUrlFromFormData); with: ''.];
      with: 'Open New Window'.


I want to create the same effect as a popup window, where the URL that
pops up is created from data in a form and the popup window appears
when the submitButton is clicked.









On Fri, May 22, 2009 at 7:08 PM, Stefan Schmiedl <[hidden email]> wrote:

> On Fri, 22 May 2009 15:45:26 -0700
> [hidden email] (Randal L. Schwartz) wrote:
>
>> >>>>> "Paul" == Paul DeBruicker <[hidden email]> writes:
>>
>> Paul> I hit send prematurely.  The URL I generate has nothing to do
>> Paul> with my seaside application.  E.G. The user chooses between
>> Paul> Google and Yahoo in a select tag element then hits submit.  I
>> Paul> then open a new window that displays www.google.com or
>> Paul> www.yahoo.com and switches their focus to that.
>>
>> I think you're supposed to use CSS for that, but the non-CSS way is:
>>
>>   html anchor newTarget url: '...'; with: 'anchor text'.
>
> The OP was asking opening a new window after hitting a submit
> *button* in a form, as far as I understood.
>
>>
>> The "newTarget" puts <a href target="_new" ...>...</a>, which all
>> modern browsers respect as "open in new window".
>>
>
> ... named "_new". If another anchor targets "_new", that
> same window will be *reused*.
>
> To really create a new window every time, use target="_blank"
>
> s.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Open URL in new window

Philippe Marschall
2009/5/23 Paul DeBruicker <[hidden email]>:

> I think I don't understand what to do with Randal's suggestion.  Do I
> put in the callback of the form submit button like this:
>
> html submitButton
>      callback:[html anchor newTarget url: (self
> createUrlFromFormData); with: ''.];
>      with: 'Open New Window'.
>
>
> I want to create the same effect as a popup window, where the URL that
> pops up is created from data in a form and the popup window appears
> when the submitButton is clicked.

That's a problem. Seaside supports opening popup windows in two ways,
either with the target attribute

html anchor
    newTarget;
    callback: [];
    with: ...

or with JavaScript, which gives you more control

html popupAnchor
    callback: [];
    with: ...

See WAPopupTest for an example

both of them work only on anchors, basically because that how HTML and
HTTP work. Doing it with a button in a form and the form data would be
possible but requires some JavaScript. In general Seaside applications
have very little use for popups. You can easily put the content of the
popup window in a component somewhere on the page without distracting
or surprising the user.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Open URL in new window

Paul DeBruicker
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 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.  Thanks for the
information about how Seaside does it.


Paul




On Sun, May 24, 2009 at 9:57 AM, Philippe Marschall
<[hidden email]> wrote:

> 2009/5/23 Paul DeBruicker <[hidden email]>:
>> I think I don't understand what to do with Randal's suggestion.  Do I
>> put in the callback of the form submit button like this:
>>
>> html submitButton
>>      callback:[html anchor newTarget url: (self
>> createUrlFromFormData); with: ''.];
>>      with: 'Open New Window'.
>>
>>
>> I want to create the same effect as a popup window, where the URL that
>> pops up is created from data in a form and the popup window appears
>> when the submitButton is clicked.
>
> That's a problem. Seaside supports opening popup windows in two ways,
> either with the target attribute
>
> html anchor
>    newTarget;
>    callback: [];
>    with: ...
>
> or with JavaScript, which gives you more control
>
> html popupAnchor
>    callback: [];
>    with: ...
>
> See WAPopupTest for an example
>
> both of them work only on anchors, basically because that how HTML and
> HTTP work. Doing it with a button in a form and the form data would be
> possible but requires some JavaScript. In general Seaside applications
> have very little use for popups. You can easily put the content of the
> popup window in a component somewhere on the page without distracting
> or surprising the user.
>
> Cheers
> Philippe
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Open URL in new window

Philippe Marschall
2009/5/24 Paul DeBruicker <[hidden email]>:
> 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

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Open URL in new window

John McKeon
In reply to this post by Paul DeBruicker


On Sun, May 24, 2009 at 10:18 AM, Paul DeBruicker <[hidden email]> wrote:
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 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 just ran across this code which works for me

html form
   attributeAt: #target put: someStringValue; "Yahoo Finance or _blank"
   action: aUrlValue;
   post;
   with: [
   ...other form rendering ]

You may have to get imaginative to get aUrlValue to have the user entered data as a parameter

John.



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.  Thanks for the
information about how Seaside does it.


Paul




On Sun, May 24, 2009 at 9:57 AM, Philippe Marschall
<[hidden email]> wrote:
> 2009/5/23 Paul DeBruicker <[hidden email]>:
>> I think I don't understand what to do with Randal's suggestion.  Do I
>> put in the callback of the form submit button like this:
>>
>> html submitButton
>>      callback:[html anchor newTarget url: (self
>> createUrlFromFormData); with: ''.];
>>      with: 'Open New Window'.
>>
>>
>> I want to create the same effect as a popup window, where the URL that
>> pops up is created from data in a form and the popup window appears
>> when the submitButton is clicked.
>
> That's a problem. Seaside supports opening popup windows in two ways,
> either with the target attribute
>
> html anchor
>    newTarget;
>    callback: [];
>    with: ...
>
> or with JavaScript, which gives you more control
>
> html popupAnchor
>    callback: [];
>    with: ...
>
> See WAPopupTest for an example
>
> both of them work only on anchors, basically because that how HTML and
> HTTP work. Doing it with a button in a form and the form data would be
> possible but requires some JavaScript. In general Seaside applications
> have very little use for popups. You can easily put the content of the
> popup window in a component somewhere on the page without distracting
> or surprising the user.
>
> Cheers
> Philippe
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
http://jmck.seasidehosting.st

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside