Hi everyone, I''m currently playing with ruby on rails, and I was trying to build a form with limited AJAX functionalities... So here is my problem : I want to create a form in order to allow visitors to choose a car make and a car model. Once the user has choosen his make in a select tag, the model select tag is supposed to be updated with the models that belong to the choosen make (using an AJAX observer). The problem is that the model menu is updated (i use a partial to fill the select tag with <option>s), but the html tags are missing, and the models aren''t selectable, nor are they separated since they''re not included between <option> and </option>. I tried to replace the drop-down menu with a simple unordered list (<ul>), updated and filled with <li> tags... and it works. Is there something special about form tags? Sorry if this isn''t clear, i haven''t practised my English for a while... Thanks for your attention, foxxbat -- Posted via http://www.ruby-forum.com/.
You can''t use plain HTML to update a <select>. You have to use the API of the select element, or you might have luck replacing the *entire* select element (not just the options) with your partial. So, yes, <select> is special. -Thomas Am 27.03.2006 um 19:08 schrieb foxxbat:> Hi everyone, > > I''m currently playing with ruby on rails, and I was trying to build a > form with limited AJAX functionalities... > > So here is my problem : I want to create a form in order to allow > visitors to choose a car make and a car model. Once the user has > choosen > his make in a select tag, the model select tag is supposed to be > updated > with the models that belong to the choosen make (using an AJAX > observer). > > The problem is that the model menu is updated (i use a partial to fill > the select tag with <option>s), but the html tags are missing, and the > models aren''t selectable, nor are they separated since they''re not > included between <option> and </option>. > > I tried to replace the drop-down menu with a simple unordered list > (<ul>), updated and filled with <li> tags... and it works. Is there > something special about form tags? > > Sorry if this isn''t clear, i haven''t practised my English for a > while... > > Thanks for your attention, > > foxxbat > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thomas Fuchs wrote:> You can''t use plain HTML to update a <select>. You have to use > the API of the select element, or you might have luck replacing the > *entire* > select element (not just the options) with your partial. > > So, yes, <select> is special. > > -Thomas > > Am 27.03.2006 um 19:08 schrieb foxxbat:Thanks a lot for the help. I have the same problem with the select API, but it seems to work fine if i replace the entire select element. foxxbat -- Posted via http://www.ruby-forum.com/.