renderPartial and dropDownList

I’m trying to use ajax and partialRender to insert new form elements into my page. I’m failing because I only know how to use drop downs with “$form->dropDownList($model,” etc. In the file that I’m trying to partially render, $form isn’t defined.

I tried using CHtml::dropDownList but then I get an error of "Object of class MyClass could not be converted to string".

I also tried “$this->widget(‘CActiveForm’)->dropDownList($model” but that adds a whole form into my html that I don’t need.

I just want a simple dropdown list that I can populate with CHtml::ListData in a page on its own so I can renderpartial it into my existing form.

Any suggestions?


this may help


Thanks for the link! I had not seen that page.

I’m using a bit of a hack now where I have one dummy model from the controller which creates the dropdown with the entries that I need. Then jQuery hides that field and I clone it to where I need it and make it visible. That way the dropdowns get updated with the database and I don’t have to worry about the renderpartial problems.

It’s a JavaScript heavy solution but it gives me a lot of control, for now.