RJS error in internet explorer

hey all,

got a rails app i'm finishing up. i have a little ajax on one of my pages where the person can choose a doctor from a drop down list and if the doctor isn't there they can click a link which blinds down a little form to add a doctor. after they submit that mini-form the page updates the div which houses the drop-down so the doctor shows up. works very nicely IN FIREFOX. I hate IE, i get an "RJS error: [object error]" with IE 6 and IE 7. i'd paste the error, but can't copy the text in the damn alert box.

i've googled this and i get a lot of results with people getting this error when adding rows to tables.. this doesn't do that, but it does insert an option to the drop down.

here's my rjs template:

unless params.has_key?("commit")   if params[:cancel]     page[:phys_form].visual_effect :blind_up   else     page[:phys_form].replace_html :partial => 'phys_form'     page[:phys_form].visual_effect :blind_down   end else   if @doctor.save     page.insert_html :bottom, 'doctor_id', '<option value="' + @doctor.id.to_s + '">' + @doctor.name + '</option>'     page[:phys_form].visual_effect :blind_up

  else     page[:phys_form].replace_html :partial => 'phys_form'   end end

any help will be majorly appreciated. thanks in advance!

stuart

stewbawka wrote:

hey all,

got a rails app i'm finishing up. i have a little ajax on one of my pages where the person can choose a doctor from a drop down list and if the doctor isn't there they can click a link which blinds down a little form to add a doctor. after they submit that mini-form the page updates the div which houses the drop-down so the doctor shows up. works very nicely IN FIREFOX. I hate IE, i get an "RJS error: [object error]" with IE 6 and IE 7. i'd paste the error, but can't copy the text in the damn alert box.

i've googled this and i get a lot of results with people getting this error when adding rows to tables.. this doesn't do that, but it does insert an option to the drop down.

here's my rjs template:

unless params.has_key?("commit")   if params[:cancel]     page[:phys_form].visual_effect :blind_up   else     page[:phys_form].replace_html :partial => 'phys_form'     page[:phys_form].visual_effect :blind_down   end else   if @doctor.save     page.insert_html :bottom, 'doctor_id', '<option value="' + @doctor.id.to_s + '">' + @doctor.name + '</option>'     page[:phys_form].visual_effect :blind_up

  else     page[:phys_form].replace_html :partial => 'phys_form'   end end

any help will be majorly appreciated. thanks in advance!

stuart

Try re-rendering and replacing the entire select control. Apparently IE chokes when you modify the inner_html of a select control.

_Kevin

thanks for taking the time to try to help me out.. i'll try this out tomorrow.

just tried putting the dropdown in a div and replacing the whole div rather than inserting another option to the bottom.. still no luck. but i've realized now that its not at all the list option insertion that's messing it up.. it fails way before that. it actually fails when i click the "Add doctor" link when its trying to replace the html in the div that houses the form to add doctors and blinds it up so its visible.. IE is basically failing at the simplest ajax things right now. Grrrrr

any advice? i really need to get this working in IE and i don't want to have to make a separate page for adding doctors. Microsoft SUCKS