hi there,
i required to validate the previous textfield upon focusing on the current textfield with javascript but at the same time make full use of yii framework.
Model:
public function rules()
{
return array(
array('firstname', 'required'),
);
}
Controller:
public function actionValidate()
{
$form = new MyForm();
if (isset($_POST['MyForm']))
{
$form->attributes = $_POST['MyForm'];
$form->validate();
}
}
how m i going to code the javascript part so much so that i could make use of CHtml::script n CHtml::ajax, n also for controller side what else need to change? i do noe that for a pure jquery scripting will be:
$(document).ready(function()
{
$(':input').focus(function()
{
$.ajax(
{
// url, data, etc.
});
});
}
thanks in advanced.