Hey all,
I’m trying to replace a select with text_field by clicking on a
link_to_remote with RJS. This part work, but then when I try to
replace the text_field back by the select tag it doesn’t work in
firefox (it does work in IE and Safari though).
Here is the code in my view:
Production:
and here is the code in my controller (one function to replace the
select by a textfield and another one to repoace the textfield by a
select):
def addtextfields
render :update do |page|
page[params[:type]].replace_html
text_field_tag(params[:type])+link_to_remote(’
cancel’,:url=>{:action=>‘canceltextfield’,:type=>params[:type]})
end
end
def canceltextfield
@type=params[:type]
@collection=User.find :all
render :update do |page|
page[params[:type]].replace_html
select_tag(params[:type],@collection.collect {|c| [c.login, c.id]
})+link_to_remote(‘add another
production’,:url=>{:action=>‘addtextfields’,:type=>params[:type]})
end
end
Any idea what’s wrong?
Thanx in advance
Pat