This is a possible duplicate. However, I can't seem to find a solution here on Stackoverflow.
I have been trying to concatenate a singe string, namely "Clone", to a textAre in yii. However, so far I have not been able to implement it correctly. Following is my textArea.
<div class="row">
<div class ="col-md-4">
<?php echo $form->labelEx($model,'tag'); ?>
<?php echo $form->textArea($model,'tag', array('rows'=>1, 'cols'=>20,'class'=>'resize-non form-control', 'id'=>'newTags')); ?>
</div>
</div>
But when I try to concatenate it like the following code, I get an error.
<?php echo $form->textArea($model,'tag'.''.'Clone', array('rows'=>1, 'cols'=>20,'class'=>'resize-non form-control', 'id'=>'newTags')); ?>
Error: Property "Dashboard.titleClone" is not defined.
I have also tried to get it using a variable like the following:
<?php $clone = $model->title.''.'Clone' ?>
<?php echo $form->textArea($model,$clone, array('rows'=>1, 'cols'=>20,'class'=>'resize-non form-control', 'id'=>'newTags')); ?>
Any help or advice is appreciated.
Found a solution. I had no clue you cold do this, but it somehow makes sense.
You can add a string to an attribute of the model by concatenating it before you use it in the activeTextArea like the following:
<?php $model->tag .= "Clone"; ?>
<div class="row">
<div class ="col-md-4">
<?php echo $form->labelEx($model,'tag'); ?>
<?php echo $form->textArea($model,'tag', array('rows'=>1, 'cols'=>20,'class'=>'resize-non form-control', 'id'=>'newTags')); ?>
</div>
</div>