Textbox Focus

Hello everyone,

I want to make focus on first textbox when my create user form is loaded in application.

I mean that cursor is directly pointing to the textbox and user can directly start typing without pressing "tab" key or "mouse". When form loads at that time focus should be on first textbox that is username.

Waiting for your suggestions.

Thanks in advance!!!

I use something like this:

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


		'focus'=>'#editUser input:text:empty:first,'

		       . '#editUser input[class=error]:first',

	)); ?>


Also we can write directly inside textbox like :

echo CHTML::textField(‘usr_name’,’’,array(‘size’=>25,‘autofocus’=>“autofocus”));

So when form loads at that time it will directly focusing this textbox.

BTW thanks for your support.

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



	// 'focus'=>array($model,'Budget_Amount') for $form->textField

	'focus'=>'#Budget_Amount' // for CHtml::textField

)); ?>