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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---