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

Text Editor For Ajax Form Text Area

$
0
0
I am having a hard time trying to configure a text-editor onto a text area in an ajax form ('CActiveForm').

Tried tinymce, fckeditor, kindeditor and a few others. while each of them successfully replaces my original text area - when i press the submit button, the message does not get attached to the original text area content and i get a 'field cannot be empty' error as it is a required field.

I would be really grateful for any suggestions :unsure:


My form code looks like this:


<?php $form = $this->beginWidget('CActiveForm', array(
	'id'=>'ext-comment-form',
    'action'=>array('/comment/comment/create'),
	'enableAjaxValidation'=>false
)); ?>

	<?php /** @var CActiveForm $form */
	echo $form->errorSummary($comment); ?>

	<div class="row">
		<?php echo $form->labelEx($comment,'message'); ?>
		<?php echo CHtml::activeTextArea($comment,'message',array('rows'=>6, 'cols'=>60, 'name'=> 'myname')); ?>
		<?php echo $form->error($comment,'message'); ?>
	</div>

	<div class="row buttons">
	    <?php if ($comment->isNewRecord) {

			echo $form->hiddenField($comment, 'type');
			echo $form->hiddenField($comment, 'key');
			echo CHtml::ajaxSubmitButton('Submit',
                array('/comment/comment/create'),
		        array(
                    'replace'=>'#ext-comment-form-new',
                    'error'=>"function(){
                        $('#Comment_message').css('border-color', 'red');
                        $('#Comment_message').css('background-color', '#fcc');
                    }"
		        ),
		        array('id'=>'ext-comment-submit' . (isset($ajaxId) ? $ajaxId : ''))
		    );
		} else {
			echo CHtml::ajaxSubmitButton('Update',
				array('/comment/comment/update', 'id'=>$comment->id),
				array(
					'replace'=>'#ext-comment-form-edit-'.$comment->id,
					'error'=>"function(){
						$('#Comment_message').css('border-color', 'red');
						$('#Comment_message').css('background-color', '#fcc');
					}"
		        ),
		        array('id'=>'ext-comment-submit' . (isset($ajaxId) ? $ajaxId : ''))
	        );
		}
		?>
	</div>

<?php $this->endWidget() ?>



Viewing all articles
Browse latest Browse all 18717

Trending Articles



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