Yiibooster

Hi Timo,

here’s the list of supported (and not yet supported) form elements (types) and the Tb-widgets they are rendered with; e.g. for a textFieldRow just use ‘type’=>‘text’.


'text' => 'textFieldRow',

'password' => 'passwordFieldRow',

'textarea' => 'textAreaRow',

'file' => 'fileFieldRow',

'radio' => 'radioButtonRow',

'checkbox' => 'checkBoxRow',

'listbox' => 'dropDownListRow',

'dropdownlist' => 'dropDownListRow',

'checkboxlist' => 'checkBoxListRow',

'radiolist' => 'radioButtonListRow',


//HTML5 types not supported in YiiBooster yet: render as textField

'url' => 'textFieldRow',

'email' => 'textFieldRow',

'number' => 'textFieldRow',


//'range'=>'activeRangeField', not supported yet

'date' => 'datepickerRow',


//new YiiBooster types

'captcha' => 'captchaRow',

'daterange' => 'dateRangeRow',

'redactor' => 'redactorRow',

'markdowneditor' => 'markdownEditorRow',

'uneditable' => 'uneditableRow',

'radiolistinline' => 'radioButtonListInlineRow',

'checkboxlistinline' => 'checkBoxListInlineRow',

'select2' => 'select2Row'

Hope it helps.

Cheers,

Don Felipe

Thanks Don!

As far as I understood by looking at the source, it maps the CForm compatible types to Booster field generators, which makes perfect sense for compatibility between TbForm and CForm. But whether its set to text or TextFieldRow, both fail. Here is the relevant part of the trace:




<p>CActiveForm and its behaviors do not have a method or closure named "textFieldRow". (/Users/devuser/dev/yii/framework/base/CComponent.php:266)</p><pre>#0 /Users/devuser/dev/yii/app/protected/extensions/bootstrap/widgets/TbFormInputElement.php(117): CComponent->__call('textFieldRow', Array)

#1 /Users/devuser/dev/yii/app/protected/extensions/bootstrap/widgets/TbFormInputElement.php(117): CActiveForm->textFieldRow(Object(Aechannel), 'email', Array, Array)

#2 /Users/devuser/dev/yii/app/protected/extensions/bootstrap/widgets/TbForm.php(161): TbFormInputElement->render()

#3 /Users/devuser/dev/yii/framework/web/form/CForm.php(477): TbForm->renderElement(Object(TbFormInputElement))

#4 /Users/devuser/dev/yii/framework/web/form/CForm.php(461): CForm->renderElements()



Any clues?

Thanks,

Timo

I can force many errors on my side but not this one. When you say "changing CForm to TbForm produces an error" where are you changing it. Please post your action and view code.

Maybe my error in thinking is trying to use TbForm exactly as CForm?

Action:




	public function actionGetChannel(){

	    $model = new Aechannel();

	    $form = new CForm('aesettings.views.forms.email', $model);

	    	    

	    if($form->submitted()){

	       $this->redirect(array('dashboard'));

	    } else{

	        $this->renderPartial('aesettings.views.default.setting', array('form'=>$form),false);

		}

	}



In case you wondering about the renderPartial part, its because I’m loading it inside a modal using ajax.

View:




echo( $form->render() ); 



rules from model:




		  return array(

		    array('email,format', 'required'),

		  );



aesettings.views.forms.email:




return array(

    'title'=>'Email settings',

 

    'elements'=>array(

        'email'=>array(

            'type'=>'text',

            'maxlength'=>32,

        ),

        'format'=>array(

            'type'=>'text',

            'maxlength'=>32,

        ),

    ),

 

    'buttons'=>array(

        'login'=>array(

            'type'=>'submit',

            'label'=>'Save',

        ),

    ),

);



Big thanks for helping me out! Timo

Try this…


public function actionGetChannel(){

    Yii::import('bootstrap.widgets.TbForm');

    $model = new Aechannel();

    $form = TbForm::createForm('aesettings.views.forms.email', $model,

        array(

            'htmlOptions'=>array('class'=>'well'),

            'type'=>'horizontal',

        )

    );

            

    if($form->submitted()){

       $this->redirect(array('dashboard'));

    } else{

       $this->renderPartial('aesettings.views.default.setting', array('form'=>$form),false);

    }

}

and "echo $form->render();" in the partial view.

Yes, that did it! :slight_smile: Big humble bow!

Hi.

How to use TbFileUpload Widget? I cannot manage to make the file list shown.

I am going to write a wiki for it, give me a day please… Cheers

I am glad to announce the release of version 1.0.5…

Thank you all who support and use this extension.

Cheers!

PS: By the way, the TbExtendedFilter has been included ;)

Thank you very much Antonio for another version of this great extension. I am updating it to take advantage of bug fixes and improvements.

TbBox broken?

Undefined index: class

/Applications/MAMP/public_html/yanus/protected/extensions/bootstrap/widgets/TbBox.php(153)

[s]This is definitely an issue, developer assumed that there is an options[‘class’] easy fix… will update asap

[/s]

You need to specify a class as now you can add any type of button, please check the new merge. Please, check the docs: TbBox enhancement

Thank you

http://www.yiiframework.com/wiki/430/how-to-use-yiibooster-tbfileupload-widget/

Regarding the TbFileUpload (wiki-link):

If one doesn’t define ‘maxFileSize’ and ‘acceptFileTypes’ when calling the widget; shouldn’t the widget automatically check if these values are defined as validation rules in the model class?

This way, one would only have to define the rules once.

Cheers,

Felipe

That is a good idea, you mean to include the checking of the validation rules and apply those to the model if the were on the JS widget setup or viceversa?

PS: I would like to personally thank you for your support and help ‘Don Felipe’

Yes. Just in case someone does not add these options but they have already been defined in the model’s attribute and validation rules. Then, an easy check via getValidators(attributeName) will do the trick. If someone adds these options to the widget setup it would make sense to set the validation rule for this scenario.

I will replace the old jQuery file upload with the TbFileUpload widget on my side soon. Let me know if you want me to do this and send another pull request… if you can wait until Wed perhaps? I owe you one for the extended filter. ;)

Of course I can wait… ;)

Hi.

As far as I know, CJuiDatepicker (or other "widgets") cannot be placed with a proper label in front of them (unless I missed something. Highly probable).

I recently proposed a wrapper that fitted my requirement (rendering a CJuiDatePicker as a regular field) but was rejected, so I’m looking for a way to do that without the hassle of extending TbActiveForm, TbInput and the like.

Question is: How to I render a CJuiDatePicker (or whatever widget for that case) like I render other fields (Example: echo $form->fileFieldRow($model, ‘fileName’);)

Thanks in advance!

Why it cannot be used as we regularly do? We have the Bootstrap jquery css to display those widgets. Isn’t it good enough?

I have something discussed with kazuo that is to create a TbHtml Helper component that will extend from CHtml and will take care of the most common input tags + HTML5 type. Maybe that could be a good place for it?

Two of the upcoming widgets are already done on 1.0.6-wip branch… I just wanted to give you an advance

There will be more to come…

PS: After I include the last ones I believe are useful for YiiBooster. Will spend some time to develop the API docs… this is going far too much and we require some proper docs.

Cheers