clevertech / YiiBooster

YiiBooster
BSD 2-Clause "Simplified" License
544 stars 306 forks source link

feature request : need support the formBuilder functionality of yii #12

Closed yiqing-95 closed 12 years ago

yiqing-95 commented 12 years ago

the original yii formbuilder functionality use the CActiveForm . if we want change it to another one just specify the activeForm property of CForm . i v tried the original yii-bootstrap extension but it will display a ugly form to me , and i do post a feature request to chris83 . seems that he don't have too much time to do this . so i post the feature request here again , hope this feature will be accomplished !

      thanks for your great working  , this one is really nice as the yii-bootstrap is 
tonydspaniard commented 12 years ago

One of the features was in fact to create automatic form displays for simple Models in TbGridView (the typical "add button") and one of the thoughts were to use CForm configuration for that. So I'll try to add it asap...

Would be nice if you could also propose something on the *-wip branch... Thanks for your words

yii-joblo commented 12 years ago

Formbuilder support is important for me too.

First I tried the direct way using the widgets, but detected the problem of the 'type' attribute of a 'TbInput' in a config array:

'elements' => array(
                    'myTextField'=>array(
                    'type'=>'bootstrap.widgets.input.TbHorizontalInput',
                    'type'=>'textfield', //<------------ problem double 'type' keys
                    'model'=>..,
                    'attribute'=>..,
                ),
            ),

Another solution can be a custom CForm and override render(), renderBody(), renderLabel() ...

tonydspaniard commented 12 years ago

I think yii-joblo has a point here... maybe is better to create a TbForm to handle those issues and implement the different types of elements that YiiBooster has should be the solution

yii-joblo commented 12 years ago

A 'TbForm extends CForm' is the only solution, the 'type'=>'...inputwidget ...' will never work.

I have detected another problem to: A 'TbInput' needs a 'form' instance of the type 'TbActiveForm' on init(). So I have to additionally assign a ready created 'form'=>... in the elements-array.

But when using the formbuilder I want a 'CForm' and a CActiveForm and CForm is not compatible ...: if($form->submitted() ..., $form->validate() ...)

yii-joblo commented 12 years ago

I have implemented the support for the formbuilder (new components TbForm, TbFormInputElement). I will upload it to my fork in a few days.

yii-joblo commented 12 years ago

Uploaded and added a pull request.

tonydspaniard commented 12 years ago

done by yii-joblo