I create a form in that I want to use onblur and onkeypress in same line.
Is it possible?
<?php
echo $form->textField($model, 'amount', array('name'=>'amount','onblur'=>'return checkallfield()', 'id'=>'amnt'));
?>
Where to give onkeypress?
Just add it like you added onblur
, as:
$form->textField($model,
'amount',
array(
'name'=>'amount',
'onblur'=>'return checkallfield();',
'onkeypress'=>'return doKeyPress();',
'id'=>'amnt'
)
);
You can use key press event in the same manner as blur:
<?php echo $form->textField($model,'amount',array('name'=>'amount','onblur'=>'console.log("onblur event triggered")','onkeyup'=>'console.log("onkeyup event triggered")','id'=>'amnt')); ?>
Check console you will be able to see events.