Forum: Ruby on Rails link_to popup problems

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
899f97295621824a5f482a286f5062ca?d=identicon&s=25 Jeremy Woertink (nuby2ruby)
on 2007-05-21 21:29
so, I have a strange problem with popups using link_to and i'm not sure
what to look for.

My problem:
When I click the link it pops open a new window. When using internet
explorer 6 or 7 *sometimes* it will open the popup window AND open in
the same window. I tested it in Opera, FireFox, Safari and they all work
just fine, only internet exploder it will do this. The main issue is
that it doesn't always do it, it's intermittent.

My code:

<%= link_to('Seating Chart', { :controller => 'pages', :action =>
'seating_chart', :id => @show }, :popup => true) %>

Any ideas?
38dedc296b7207c2a0d59fd3aac906b4?d=identicon&s=25 Ramanan Neelakantan (sea922n)
on 2008-02-29 21:32
Jeremy Woertink wrote:
> so, I have a strange problem with popups using link_to and i'm not sure
> what to look for.
>
> My problem:
> When I click the link it pops open a new window. When using internet
> explorer 6 or 7 *sometimes* it will open the popup window AND open in
> the same window. I tested it in Opera, FireFox, Safari and they all work
> just fine, only internet exploder it will do this. The main issue is
> that it doesn't always do it, it's intermittent.
>
> My code:
>
> <%= link_to('Seating Chart', { :controller => 'pages', :action =>
> 'seating_chart', :id => @show }, :popup => true) %>
>
> Any ideas?

Hi there,
Did you resolve this issue?  I am having similar issue.

Thanks
6e26026e18f5cad3101465c9c7101630?d=identicon&s=25 yoche2001 (Guest)
on 2008-05-18 18:54
(Received via mailing list)
Hi,

> <%= link_to('Seating Chart', { :controller => 'pages', :action =>
> 'seating_chart', :id => @show }, :popup => true) %>
>
> Any ideas?
Well, in fact I dont have a real solution to your specific problem,
but some hints:
If you look at the generated html/js-code you should see a "return
false" as last call. This prevents the browser from following the href-
Link. But if there is any problem within the javascript-Code, the
return false is not executed anymore and thus, the browser jumps to
the href, even if the opening of the popup opens. But how can there be
an error within the javascript when it is fully generated by rails,
one might ask.

The solution might be found within project-specific javascript-code.
In my case I had a jquery-function which appended to all links and
which had an error. So every link produces an js-Error. Unfortunately,
these errors are hard to track - even with firebug- since the page is
newly loaded all js-Errors are reseted. One way which sometimes helps
is to modify the onclick-call via firebug, so that before the return-
call an alert("hi!") is called. So if you see no alert that is a
strong indicator that there is anything wrong with your js.

Another hint: just disable you js-library temporarily so that you can
see if the error occures nevertheless.

Hope this helped you a bit.

Greetings,
Yoche2001
6e26026e18f5cad3101465c9c7101630?d=identicon&s=25 yoche2001 (Guest)
on 2008-05-18 19:05
(Received via mailing list)
Hi,

just a hint: try to disable temporarily your used js-library. I once
had an error in an jquery-event (added the click-Event) twice so that
each link with a onclick-Handler produced an js-Error and the "return
false" was never reached. Unfortunately these errors are hard to
track, even with firebug, since the main-page is newly loaded and so
the js-error-log is cleared.

Greetings,
Yoche2001
This topic is locked and can not be replied to.