Hi,
What’s the best way to change the way a form is generated by Gii? I want to change some of the classes and the way the error messages are displayed.
Thanks
Hi,
What’s the best way to change the way a form is generated by Gii? I want to change some of the classes and the way the error messages are displayed.
Thanks
The css for the form are in css/form.css, you should accomplish to change as you wish just by editing this file.
All code that is in views/controllerId/_form can be customized, you should consider it like an example, not like an untouchable standard.
All widgets (or CHtml::something) can be customized with the property that are specified in the doc (see the CHtml or the widget you are using).
Thanks for your response zaccaria. I wanted to change the markup actually, not just the css, should have made that clear. I realise I can edit the _form file but then I’d have to do that each time I generated a form and that would take away a little bit from the whole point of having the code generated so I was wondering if there was a way to customise the code that is generated without messing with the framework’s code itself.
Read the section "Customizing code templates". You may want to customize framework/gii/crud/templates/default/_form.php (and of course store it in a place specified by generatorPaths in your application config).
http://www.yiiframework.com/doc/guide/1.1/en/topics.gii
/Tommy
Perfect! Thanks tri.