Yii Framework Forum: Yiibooster - Yii Framework Forum

Jump to content

  • (16 Pages)
  • +
  • « First
  • 6
  • 7
  • 8
  • 9
  • 10
  • Last »
  • You cannot start a new topic
  • This topic is locked

Yiibooster Make it gorgeous. Do it Fast. Rate Topic: ***** 6 Votes

#141 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 04 December 2012 - 09:30 PM

 timster, on 04 December 2012 - 04:56 PM, said:

Hi! Many thanks for the great work with this one (obviously also to Chris)!

I'm trying to use the new form builder implementation (added abt. 1 month ago), but running into trouble there. I have a normal CForm setup, which works the way it should, but changing CForm to TbForm produces an error:

"CActiveForm and its behaviors do not have a method or closure named "textFieldRow".

Tried to track this one down, but still a little too newbie with Yii. :-(

One tip if anyone else is experimenting with the form builder, in your view you have to use

<?php echo( $form->render() ); ?>


instead of the tutorial suggested

<?php echo( $form ); ?>


Many thanks,
Timo



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
0

#142 User is offline   timster 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 13-July 12

Posted 05 December 2012 - 02:09 AM

 Don Felipe, on 04 December 2012 - 09:30 PM, said:

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',



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
0

#143 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 05 December 2012 - 02:48 AM

 timster, on 05 December 2012 - 02:09 AM, said:

<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?


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.
0

#144 User is offline   timster 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 13-July 12

Posted 05 December 2012 - 03:43 AM

 Don Felipe, on 05 December 2012 - 02:48 AM, said:

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
0

#145 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 05 December 2012 - 04:19 AM

 timster, on 05 December 2012 - 03:43 AM, said:

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);
		}
	}



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.
1

#146 User is offline   timster 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 13-July 12

Posted 05 December 2012 - 04:32 AM

Yes, that did it! :-) Big humble bow!
0

#147 User is offline   jmariani 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-January 12

Posted 08 December 2012 - 04:22 AM

Hi.

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

#148 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 08 December 2012 - 05:38 AM

 jmariani, on 08 December 2012 - 04:22 AM, said:

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
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#149 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 08 December 2012 - 05:39 AM

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 ;)
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#150 User is offline   tomsea 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 66
  • Joined: 25-November 11

Posted 08 December 2012 - 10:06 AM

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

#151 User is offline   jmariani 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-January 12

Posted 09 December 2012 - 10:01 AM

TbBox broken?

Undefined index: class

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

#152 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 09 December 2012 - 10:48 AM

 jmariani, on 09 December 2012 - 10:01 AM, said:

TbBox broken?

Undefined index: class

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


This is definitely an issue, developer assumed that there is an options['class'] easy fix.. will update asap


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
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#153 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 09 December 2012 - 10:54 AM

 jmariani, on 08 December 2012 - 04:22 AM, said:

Hi.

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


http://www.yiiframew...eupload-widget/
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#154 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 09 December 2012 - 11:56 PM

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
0

#155 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 10 December 2012 - 02:56 AM

 Don Felipe, on 09 December 2012 - 11:56 PM, said:

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'
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#156 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 10 December 2012 - 04:04 AM

 Antonio Ramirez, on 10 December 2012 - 02:56 AM, said:

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. ;)
0

#157 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 10 December 2012 - 06:41 AM

 Don Felipe, on 10 December 2012 - 04:04 AM, said:

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... ;)
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#158 User is offline   jmariani 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-January 12

Posted 10 December 2012 - 11:07 AM

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!
0

#159 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 10 December 2012 - 04:10 PM

 jmariani, on 10 December 2012 - 11:07 AM, said:

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?
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#160 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 10 December 2012 - 05:24 PM

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

Attached File(s)


¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

Share this topic:


  • (16 Pages)
  • +
  • « First
  • 6
  • 7
  • 8
  • 9
  • 10
  • Last »
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users