<ASK> _form in yii2. how we set focus like yii1 did?

hi all…

in yii1 we easily set focus to a field,

but in yii2, where we can find it?

i tried many place but not work.

here in yii1:


    $form = $this->beginWidget('CActiveForm', array(

        'id' => 'post-form',

        'enableClientValidation' => TRUE,

        'clientOptions' => array(

            'validateOnSubmit' => TRUE,

            'validateOnChange' => TRUE,


        'focus' => array($model, 'postID'),



thank you for your help.

thank you for all yii developers :)

We have not added this feature to the PHP API because you can achieve this with very simple javascript:

thank you sir.

why not yii2 work like yii1 this focus thing sir?

i think this is sweet feature.

is it possible to integrate this feature so we all can use it in yii2 GA.

please sir. may be we all need it.

thank you.