Return Key Not Working For Textarea

[size="4"][font="Arial Black"]I have the following textArea in one of my views.[/font][/size]

[size="2"][font="Courier New"]<div class="row">

<?php echo $form->labelEx($model,‘ref_description’); ?>

<?php echo $form->textArea($model,‘ref_description’,array(‘rows’=>6, ‘cols’=>50)); ?>

<?php echo $form->error($model,‘ref_description’); ?>

</div>[/font][/size]

[size=“4”][font=“Arial Black”]Why isn’t it able to return a newline when pressing the enter key but instead it’s moving to the following textField?

Whole Code:[/font][/size]

[size="2"][font="Courier New"]<div class="form">

<?php $form=$this->beginWidget(‘CActiveForm’, array(

‘id’=>‘report-references-form’,

‘enableAjaxValidation’=>false,

)); ?>

<p class="note">Fields with <span class="required">*</span> are required.</p>

<?php echo $form->errorSummary($model); ?>

<div class="row">

<?php echo $form->labelEx($model,‘ref_name’); ?>

<?php echo $form->textField($model,‘ref_name’,array(‘size’=>60,‘maxlength’=>150)); ?>

<?php echo $form->error($model,‘ref_name’); ?>

</div>

<div class="row">

<?php echo $form->labelEx($model,‘ref_description’); ?>

<?php echo $form->textArea($model,‘ref_description’,array(‘rows’=>6, ‘cols’=>50)); ?>

<?php echo $form->error($model,‘ref_description’); ?>

</div>

<div class="row">

<?php echo $form->labelEx($model,‘ref_quarter’); ?>

<?php echo $form->textField($model,‘ref_quarter’); ?>

<?php echo $form->error($model,‘ref_quarter’); ?>

</div>

<div class="row">

<?php echo $form->labelEx($model,‘ref_year’); ?>

<?php echo $form->textField($model,‘ref_year’); ?>

<?php echo $form->error($model,‘ref_year’); ?>

</div>

<div class="row">

<?php echo $form->labelEx($model,‘ref_date’); ?>

<?php echo $form->textField($model,‘ref_date’); ?>

<?php echo $form->error($model,‘ref_date’); ?>

</div>

<div class="row buttons">

<?php echo CHtml::submitButton($model->isNewRecord ? ‘Create’ : ‘Save’); ?>

</div>

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

</div><!-- form -->[/font][/size]

[size="4"]

[font=“Arial Black”]Please suggest about anything as this thing looks really stupid and I can’t seem to find a way around it tried javscript with shift+enter command and other things.[/font][/size]

Found the solution:

For further help to this question regarding the Yii. What needs to be changed is in the main layout.

There is a javascript code:

[size=“2”][font=“Courier New”] $(‘body’).on(‘keydown’, ‘input, select’ , ‘textarea’, function(e) {

var self = &#036;(this)


  , form = self.parents('form:eq(0)')


  , focusable


  , next


  ;


if (e.keyCode == 13) {


    focusable = form.find('input,a,select,button,textarea').filter(':visible:not(:disabled)');


    next = focusable.eq(focusable.index(this)+1);


    if (next.length) {


        next.focus();


    } else {


        form.submit();


    }


    return false;


}

});[/font][/size]

Remove the textarea from the $(‘body’).on function ONLY!

[size=“2”][font=“Courier New”] $(‘body’).on(‘keydown’, ‘input, select’, function(e) {

var self = &#036;(this)


  , form = self.parents('form:eq(0)')


  , focusable


  , next


  ;


if (e.keyCode == 13) {


    focusable = form.find('input,a,select,button,textarea').filter(':visible:not(:disabled)');


    next = focusable.eq(focusable.index(this)+1);


    if (next.length) {


        next.focus();


    } else {


        form.submit();


    }


    return false;


}

});[/font][/size]

This seems a Yii 1.x scenario. This forum being a Yii 2.0 forum, you may want to post it in the Yii 1.0 discussions forum to get a better response.