Hello, I''m using form_remote_tag with the appear effect to show some data, like so: <%= form_remote_tag :url => {:action => "list"}, :update => "list_results", :complete => visual_effect(:toggle_appear, ''list_results'') %> Works nicely, however, I would like to disable some select fields in my form when the visual stuff is shown.. I tried adding: :success => "document.getElementsByTagName.(''select'').disabled = true;" This, however, does not work. I also wanted to change the text value on my submit button from "GO" to "Close" - as it will toggle the appear-effect. I tried this: :success => "document.getElementByName.(''commit'').value = ''Close'';" Not working :-/ Any ideas ? /mich --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
On 22.8.2006, at 17.20, mich wrote:> > Hello, > > I''m using form_remote_tag with the appear effect to show some data, > like so: > > <%= form_remote_tag :url => {:action => "list"}, :update => > "list_results", > :complete => visual_effect(:toggle_appear, ''list_results'') %> > > Works nicely, however, I would like to disable some select fields > in my > form when the visual stuff is shown.. > > I tried adding: > :success => "document.getElementsByTagName.(''select'').disabled = > true;"1) You have a dot between the getElementsByTagName call and its parameter list. 2) The function returns an array of elements. You need to loop through them and disable them one by one.> > This, however, does not work. I also wanted to change the text > value on > my submit button from "GO" to "Close" - as it will toggle the > appear-effect. I tried this: > > :success => "document.getElementByName.(''commit'').value = ''Close'';"There is no function getElementByName for the document object. You might have meant getElementsByName. You should probably use the dollar function $(''commit'') [1] anyway, and use ID''s instead of names. Anyways, to find out what''s wrong, I highly suggest getting the FireBug [2] Firefox extension. With it you have a lot easier to debug your scripts. //jarkko [1] http://wiki.script.aculo.us/scriptaculous/show/DollarFunction [2] https://addons.mozilla.org/firefox/1843/ -- Jarkko Laine http://jlaine.net http://odesign.fi --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Jarkko Laine wrote:> 1) You have a dot between the getElementsByTagName call and its > parameter list.Typos..> 2) The function returns an array of elements. You need to loop > through them and disable them one by one.Ok - makes sense.> There is no function getElementByName for the document object. You > might have meant getElementsByName. You should probably use the > dollar function $(''commit'') [1] anyway, and use ID''s instead of names.Another typo ;) I used $(''commit'').value = "blah" - and added id="commit" to my submit tag - and now it works !> Anyways, to find out what''s wrong, I highly suggest getting the > FireBug [2] Firefox extension. With it you have a lot easier to debug > your scripts.Already have it - but with above code (without typos obvioulsy) it did not report any errors. Thanks anyway ! /mich --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---