As written this works fine. But if I want to use ‘id’ instead of ‘name’ as the sub-form element, the dropdown doesn’t render. I’m not getting an error, and the rest of the form is there, just not the dropdown.
Is this a bug? Is ‘id’ a reserved word in this context? Is there another way I should be doing this?
Edit: Yii 1.1.0, PHP 5.3.0, Apache 2 on Mac OS X.6
Edit: OK, not a bug. See post #10 below. Sorry for the false alarm.
Now I’m wondering if this is a PHP bug. Having traced through the ->render() process, a simple echo $form; in the controller action behaves exactly the same (no surprise as echo is exactly what render() ends up doing). bugs.php.net is down at the moment so it’s hard to search. I suspect __toString().
OK, scratch that. Now I suspect CForm::renderElement().
For some reason the CForm object containing the dropdown list gets a visible property of false when the dropdown list is named ‘id’, but true otherwise.
I guess this is expected behavior. Issue was that ‘id’ was not a required attribute for this model. Hence massive assignment prohibited by CFormInputElement::evaluateVisible().