yii framework populate the values in textarea

10,572

Solution 1

You can do this, if you absolutely have to use $savedvalues array:

$model->corporateaddress=$savedvalues['varCorporateAddress'];
$form->textArea($model, 'corporateaddress', array('rows'=>6, 'cols'=>50));

Solution 2

The values of the textarea will be set to $model->corporateaddress. You could set in your model a default value if that is the case.

I found a similar question here:

http://www.yiiframework.com/forum/index.php/topic/10454-textarea-set-default-text/

Share:
10,572
designersvsoft
Author by

designersvsoft

I am a web Designer

Updated on June 04, 2022

Comments

  • designersvsoft
    designersvsoft almost 2 years

    I need to populate the value in textarea.

    For text field i used the following command $form->textField($model,'phone',array('value'=>$savedvalues['varPhone']))

    It works fine. But for textarea the 'value' parameter is not supported.

    Here where i have to display my value parameter

    $form->textArea($model, 'corporateaddress', array('rows'=>6, 'cols'=>50))
    
    • bool.dev
      bool.dev about 12 years
      do you have to use the $savedValues array for textArea? and not a default value? do you not want a default value, but only some helper text? for default value @mazzucci solution will work
    • designersvsoft
      designersvsoft about 12 years
      yes i want to use the $savedValues array for textArea. I do not need the default value.
  • bool.dev
    bool.dev about 12 years
    try this it should work out, just adding to what mazzucci already said