I added :accesskey=>"D" to the html options hash of my link_to tag but nothing happened. Should I keep trying or is this not an option yet? bruce
Bruce Balmer <brucebalmer@...> writes:> I added :accesskey=>"D" to the html options hash of my link_to tag > but nothing happened. > > Should I keep trying or is this not an option yet?It''s probably just your syntax--Rails just passes HTML options through without looking at them, and access keys work just fine. To help see if it''s your syntax, here''s a real example from an app I''m working on that definitely functions correctly: <%= radio_button_tag :search_type, "first_name", false, :id => ''search_type_first_name'', :accesskey => ''3'' %> I know it''s not a link_to, but it''s the same idea. --Forrest
Bruce Balmer wrote:> I added :accesskey=>"D" to the html options hash of my link_to tag but > nothing happened.It works for me, e.g. <%= link_to ''Back'', {:action => ''list''}, :accesskey => "b" %> or <%= link_to ''Back'', {:action => ''list''}, {:accesskey => "b"} %> Do you see the attribute when you do "View Source" in the browser? Happy New Year! Justin
Maybe I left out a vital bit of the story. I just tried the suggestions given to me and they did not work. I am running SAFARI on Mac OS X 10.4. Does that make a difference? bruce On 31-Dec-05, at 8:21 PM, Justin Forder wrote:> :accesskey => "b"-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060101/133b52f1/attachment.html
I just tried it in firefox. Same thing and ''yes'' I see the attribute in the browser source. My syntax is identical to that shown below.> > <%= link_to ''Back'', {:action => ''list''}, :accesskey => "b" %> > > or > > <%= link_to ''Back'', {:action => ''list''}, {:accesskey => "b"} %> > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Bruce Balmer wrote:> Maybe I left out a vital bit of the story. I just tried the suggestions > given to me and they did not work. I am running SAFARI on Mac OS X > 10.4. Does that make a difference?Are you using the Control key with the access key (rather than Command)? regards Justin
Justin: Yes. I am. I have also tried the command key, the option key, the shift key and all possible permutations of them. I read a couple of comments on the web which indicate that access keys are not working in Safari although apple seems to think they are. But I can''t really find anything definitive. I am hoping that someone who is using Safari can confirm they ARE working and tell me how they do it. bruce On 1-Jan-06, at 3:36 AM, Justin Forder wrote:> Bruce Balmer wrote: > >> Maybe I left out a vital bit of the story. I just tried the >> suggestions given to me and they did not work. I am running >> SAFARI on Mac OS X 10.4. Does that make a difference? > > Are you using the Control key with the access key (rather than > Command)? > > regards > > Justin > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Bruce Balmer wrote:> Justin: > > Yes. I am. I have also tried the command key, the option key, the shift > key and all possible permutations of them. I read a couple of comments > on the web which indicate that access keys are not working in Safari > although apple seems to think they are. But I can''t really find > anything definitive. I am hoping that someone who is using Safari can > confirm they ARE working and tell me how they do it.That''s strange - I tried this with Safari on Tiger before replying, by making a small modification to a toy application in Locomotive, and then retyped the relevant line in my message on a Windows machine. Let me do this from scratch: in Locomotive, new application "bruce" open Terminal in this application, and use $ script/generate controller say hello goodbye run the application (it''s on port 3003 for me) preview app in browser, and check that I see the placeholders for the hello and goodbye pages http://localhost:3003/say/hello http://localhost:3003/say/goodbye Open TextMate on the project, and edit app/views/say/hello.rhtml to include <%= link_to ''Goodbye'', {:action => ''goodbye''}, :accesskey => ''g'' %> save, view in browser - I can navigate through that link either by clicking on it or by using Ctrl-g This is using Locomotive 1.0 regards Justin
On 2006-01-01 15:36:49 +0000, Justin Forder wrote:> Bruce Balmer wrote: > > >Justin: > > > >Yes. I am. I have also tried the command key, the option key, the shift > >key and all possible permutations of them. I read a couple of comments > >on the web which indicate that access keys are not working in Safari > >although apple seems to think they are. But I can''t really find > >anything definitive. I am hoping that someone who is using Safari can > >confirm they ARE working and tell me how they do it. > > That''s strange - I tried this with Safari on Tiger before replying, by > making a small modification to a toy application in Locomotive, and then > retyped the relevant line in my message on a Windows machine. > > Let me do this from scratch:[snip]> save, view in browser - I can navigate through that link either by > clicking on it or by using Ctrl-gYes, Ctrl is the modifier in Safari.> This is using Locomotive 1.0I''m using Darwinports and gem installed RoR and I''ve been having some trouble with extra HTML attributes too, and I found out the {}''s are significant: <%= link_to "Goodbye!", {:action => "goodbye"}, :accesskey => "g", :title => "Bye bye!" %> Works. Whereas this: <%= link_to "Goodbye!", :action => "goodbye", :accesskey => "g", :title => "Bye bye!" %> Doesn''t work, instead it generates a link pointing to "/say/goodbye?accesskey=f&title=Bye+bye%21". It''s probably obvious why, and I think I know the reason. I expect to be sure sometime later in Agile Web Dev w. RoR, I''m just too much of a newbie to take my chances explaining it yet in public. :-) Anyway, Bruce, this might be the same problem you''re having. Maybe not. Have a nice day Morten -- http://m.mongers.org/weblog/
On 1.1.2006, at 20.25, Morten Liebach wrote:> I''m using Darwinports and gem installed RoR and I''ve been having some > trouble with extra HTML attributes too, and I found out the {}''s are > significant: > > <%= link_to "Goodbye!", {:action => "goodbye"}, :accesskey => "g", > :title => "Bye bye!" %> > > Works. Whereas this: > > <%= link_to "Goodbye!", :action => "goodbye", :accesskey => "g", > :title => "Bye bye!" %> > > Doesn''t work, instead it generates a link pointing to > "/say/goodbye?accesskey=f&title=Bye+bye%21". > > It''s probably obvious why, and I think I know the reason. I expect to > be sure sometime later in Agile Web Dev w. RoR, I''m just too much of a > newbie to take my chances explaining it yet in public. :-)link_to(name, options = {}, html_options = nil, *parameters_for_method_reference) The reason is that if you omit the curly braces, all of the hash values are considered to be part of the first hash parameter of link_to, "options". However, accesskey and title belong to the "html_options" parameter, so you need to separate the two hashes with curlies. Using the braces around both hashes makes it also easier to read the code later on. //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2363 bytes Desc: not available Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060101/52763935/smime-0001.bin
Hi: I updated to locomotive 1.0 I have no idea if that is what solved the problem but things are working now with access keys for me. I also wrapped my :action=>goodbye in braces (which I had not done before) and that may have been it. Thanks to all that helped and particularly Justin, who may have provided the breakthrough. bruce On 1-Jan-06, at 8:36 AM, Justin Forder wrote:> Bruce Balmer wrote: > >> Justin: >> Yes. I am. I have also tried the command key, the option key, the >> shift key and all possible permutations of them. I read a couple >> of comments on the web which indicate that access keys are not >> working in Safari although apple seems to think they are. But I >> can''t really find anything definitive. I am hoping that someone >> who is using Safari can confirm they ARE working and tell me how >> they do it. > > That''s strange - I tried this with Safari on Tiger before replying, > by making a small modification to a toy application in Locomotive, > and then retyped the relevant line in my message on a Windows machine. > > Let me do this from scratch: > > in Locomotive, new application "bruce" > > open Terminal in this application, and use > > $ script/generate controller say hello goodbye > > run the application (it''s on port 3003 for me) > > preview app in browser, and check that I see the placeholders for > the hello and goodbye pages > > http://localhost:3003/say/hello > http://localhost:3003/say/goodbye > > Open TextMate on the project, and edit app/views/say/hello.rhtml > to include > > <%= link_to ''Goodbye'', {:action => ''goodbye''}, :accesskey => ''g'' %> > > save, view in browser - I can navigate through that link either by > clicking on it or by using Ctrl-g > > This is using Locomotive 1.0 > > regards > > Justin > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Bruce Balmer wrote:> I updated to locomotive 1.0 I have no idea if that is what solved > the problem but things are working now with access keys for me. I > also wrapped my :action=>goodbye in braces (which I had not done > before) and that may have been it.Make one change at a time, and test at each step, so that you can be clear on which change gave what result. The braces are the critical thing - as Jarkko pointed out, there are two hash arguments, and unless you put those braces in, all the key/value pairs will be going into the first hash. I agree with Jarkko that the clearest style is with braces around both hashes - as in my second example earlier: <%= link_to ''Back'', {:action => ''list''}, {:accesskey => "b"} %> It''s a pity that the examples in the RDoc don''t follow that style. I asked earlier if you were seeing the accesskey attribute when you did "View Source" in the browser. Try that again, with and without the braces, and note the difference. By the way, you could have tested Safari''s handling of the accesskey attribute using static HTML files, rather than compounding your uncertainties regarding Safari with your uncertainties about the link_to helper in Rails.> Thanks to all that helped and > particularly Justin, who may have provided the breakthrough.You are welcome! Justin