Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Textarea value not saved

$
0
0
LS.

This is probably something well known regarding textarea in HTML but currently I am running around in circles. Hopefully you can help!

In my form I have created a textarea:
<?php echo $form->textArea($model1,'Totalview',array('rows'=>'28','cols'=>'56')); ?> 


Totalview is a property of $model1 and resides in the MySQL database. (Any thoughts on which data type is best?)

Somewhere in my Javascript (using jQuery) I fill the textarea using:
$('#Offer_Totalview').val(textForOverview); 


This seems to be working fine. I see the text in the textarea in my HTML form. However when I save my model to the database, the value of my textarea is not saved. Before saving, I loop over the model to see what data the fields hold. And indeed $model1->Totalview is empty.

When I give $model1->Totalview a value manually, the value is saved to the database without problems.

My guess is that I shouldn't use $('#Offer_Totalview').val(textForOverview) but what then? I have also used $('#Offer_Totalview').html(textForOverview)which does show the text but nothing in the database.

Thank you in advance!

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>