Closed yiqing-95 closed 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
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() ...
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
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() ...)
I have implemented the support for the formbuilder (new components TbForm, TbFormInputElement). I will upload it to my fork in a few days.
Uploaded and added a pull request.
done by yii-joblo
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 !