Luca Scaljery
2006-Dec-08 23:16 UTC
javascript problem with name tag (name => ''address[street]'')
Hi All I just noticed that I don''t really know how to deal with the names which are needed by Rais, for example, with textfield, like <%= text_field("address", "street", "size" => 10, "name" =>"address[street]") %> I need to set the focus to this textfield, but Javascript doesn''t seem to be happy at all with the following call: document.regform.address[street].focus() Any suggestions how to do this ? Thanks a lot LuCa -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2006-Dec-09 00:56 UTC
Re: javascript problem with name tag (name => ''address[street]'')
> Hi All > > I just noticed that I don''t really know how to deal with the names which > are needed by Rais, for example, with textfield, like > <%= text_field("address", "street", "size" => 10, "name" > =>"address[street]") %> > > I need to set the focus to this textfield, but Javascript doesn''t seem > to be happy at all with the following call: > document.regform.address[street].focus() > > Any suggestions how to do this ?Well, if you''ve got the prototype library loaded up you could do: $(''address_street'').focus(); This works because rails will give that text field an id of "address_street"... Otherwise you can do: document.regform.elements["address[street]"].focus(); -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Luca Scaljery
2006-Dec-09 11:38 UTC
Re: javascript problem with name tag (name => ''address[stree
hi the javascript example is perfect!. The prototype lib is new for me, it looks very interesting!! thnx a lot LuCa -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---