Convert Input Text To Html Vs Textarea

Hi All,

I’m learning Yii while working on an adaptation of a blog. I want to create a _form.php view thats read only. The main component is the entry field. I obviously want to keep the format as inputted by the user but am now wondering the best way to go about that. Obviously one option would be to use textArea with something like the below (though I still have to figure out how to make the textArea height default to the size required by the text)

print $form->textArea($model,'entry',array('rows'=>'100', 'cols'=>75, 'disabled'=>'true', 'style' => 'resize:none'));

I guess another way would be to convert the text into HTML on save / update? As a newbie, I’m aware that I might be missing another route, or making this all a little more complext than I need. Could I get your guidance on what might be the best route to take here


i think you may like this

<?php echo $form->textArea($model,'description',array('size'=>60,'maxlength'=>1000)); ?>

Hi thanks for your reply, but isn’t that a default textArea? which is what I’m trying to get away from.

I want to create a _form.php view thats read only, with a field height for the size of the returned text (Basically whats the best way to read a entry out of a databse and format it HTML to display on a layout).

Best Way…you can create the one filed on DB and defind this filed in value…

1)first you want to create the one filed name input_type.

2)assignd this DataType filed on ENUM (‘text’,‘password’,‘textarea’,‘select’,‘radio’,‘checkbox’,‘file’,‘label’)

for ex…

If I want to display the textarea then you want to assgined the value on this filed -Description and it’s value is textarea

This looks a good implementation:

I doubt you’ll find a Yii solution because you need to use javascript here.

There are simpler solutions (just google) but with less features like the dynamic height change when pasting etc.

Good luck.