i have started working with Yii from sometime now and alot of my time & effort is going into arranging the form elements in the proper order & format, in good layout. Its so tedious & time consuming doing completely in code.
I have so many complex forms in my project, having even 15 to 45 fields in one form.
Lets take a form: there are 35 fields: textbox, dropdown, textarea, date/time, radio & also a CGridView, all there.
Now i have to arrange them in proper sequence: writing the <div class=""> tags all over the place & so nested.
There are multiple sections, single & multiple columns.
Normally the size of the textbox, dropdown, etc are not the one we set in the database table,
So setting the right size/width to the elements: editing the htmloptions (so many of them) and for some we have to change it many time so as to suit the design.
i was thinking is there any way around to layout the form elements easily.
i thought for CForm but that too didn’t the process any easy. Reuseability is not my concern right now.
hopefully u people can well imagine how tidious it becomes to make such form ready for display.
i am really in need of something to save this Time & EFFORT.
automatically generate dropdown looking if there are relations on this field
automatically generate dropdown if the field is an enum
automatically generate checkbox if is int(1)
I also edited the generator of view and admin, in order to:
show the field description for the related fields
show yes/no for int(1) (boolean)
this is a big help. By the way keep in mind that you will never generate a perfect form, you will always have to correct some detail, so choose a good treshold between extending gii and manual editing (like, not use 100 hour for create a complex gii in order to avoid 10h of editing).
Remember that Yii always grows, gii follow the framework but your extension no!!! Sooner or later you will have to redo this extension, and the more deeper you are going, the more paifull will be following the news of the framework.