Thank you Hassan -- perhaps I am doing something stupid and not
realising it? It is failing for me in Firefox (latest version) and
Chrome (latest version) I have not tested MSIE. I am running Rails
2.3.2.
I have a partial, /channels/_channelnotesfield.html.erb, with
javascript, as follows:
Notes:
<%= select("channelnotes", "channelnotes", Channelnote.find
(:all, :order => 'tstamp DESC', :limit =>3, :conditions =>
["deleted=0"]).collect {|p| [ p.note, p.note]}, { :include_blank =>
true , :selected=>0, :value=>""},{:onKeyDown => "fnKeyDownHandler
(this, event);", :onKeyUp => "fnKeyUpHandler_A(this, event); return
false;", :onKeyPress => "return fnKeyPressHandler_A(this,
event);", :onChange => "fnChangeHandler_A(this, event);", :style =>
"width:350px;",:id=> "channelnotes"}) %>
<%= observe_field "channelnotes", :url => {:controller
=> :channels, :action => 'notesboxchange' }, :frequency => 1.0, :with
=> "'channelnotes=' + value" %>
<script>
function doReset(){
document.getElementById("channelnotes").options.selectedIndex = 0;
document.getElementById("channelnotes").options
[document.getElementById
("channelnotes").options.selectedIndex].value="";
alert("doReset()"); // so we can see if the javascript is being
executed
}
doReset();
</script>
In my ChannelsController I call it with:
def resetchannelnotes
current_associate.update_attributes(:channelnotes => '',:noteson =>
0)
render :partial => 'channelnotesfield'
end
But the javascript only gets called when the entire page loads. Thank
you -Rvince
--~--~---------~--~----~------------~-------~--~----~
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 [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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---