In Cactiveform Can I Make The Enter Key Behave Like A Tab Key?

I’m using CActiveForm and was wondering if it is possible to use the enter key (return key) to tab (move to next field) instead of submitting the form… I have already changed the SubmitButton to onclick. I basically want to swap the tab and enter key. I don’t know ajax coding.

Hi ladymtnbikrdr

check the bellow link

On section (answers) 8 and 10, there is a solution

So register the javascript code with

Yii::app()->clientScript->registerScript(‘anamedjs’, “your jquery code”);

Let inform us if it works! :)

Oh my God it worked. Thank you so much. Now I am being greedy and want to try answers 1-2. I just don’t know where all the pieces go. I wish I knew jquery it is pretty cool. For answer 1. do I just replace the code from answer 10? Where does " $(’#form-id’).enterAsTab(); " go.

Thank you again.

I was able to get the jquery enterAsTab to work. I added the following code at the beginning of the view file.









<script type="text/javascript">

$("#bsm-header-form").enterAsTab({ ‘allowSubmit’: true});


I really would like to get the plusastab.js to work. Do you know if it is possible for the jquery plugin plusastab.js to work with the Yii Framework? This jquery script looks awesome.

Thanks again for leading me in the right direction.

One more question. I’m using the jquery enterAsTab example you showed me. The enter key works except when it comes to a <a href> which it skips over. Would I use ${this}.attr(“type”) and what type would <a href> be. Or with this.find(‘input, select’)?

Sorry for my ignorance.