PDA

View Full Version : Somebody can tell why it does'n work?



hazek
5 Jun 2008, 7:57 AM
Code above..........


<ext:body extLocation="${pageContext.request.contextPath}/pages/js/ext-2.0">


<ext:onReady>

Ext.getCmp("user").on('keyup',function(){alert("Alert for example");});
</ext:onReady>



<ext:form.textField id="user" fieldLabel="Usuario" name="user"/>


Code bottom..........


And when i change the Event on('keyup'... to on('change'... it works... :-?

I need to detect when a character is enter on the textfiel to compare.
Thanks.

mjlecomte
5 Jun 2008, 8:02 AM
Did you read the API?


Keyup input field event. This event only fires if enableKeyEvents is set to true.

hazek
5 Jun 2008, 8:16 AM
Did you read the API?
Thanks a lot.
Anyway i was read too that it maybe not enough
However the problem is solved... The solution was put this code:



<script>

Ext.onReady(
function(){

Ext.override(Ext.form.Fiel



d, {

fireKey : function(e) {

if(((Ext.isIE && e.type == 'keydown') || e.type == 'keypress') && e.isSpecialKey()) {
this.fireEvent('specialkey', this, e);
}
else {
this.fireEvent(e.type, this, e);
}
}
, initEvents : function() {
// this.el.on(Ext.isIE ? "keydown" : "keypress", this.fireKey, this);
this.el.on("focus", this.onFocus, this);
this.el.on("blur", this.onBlur, this);
this.el.on("keydown", this.fireKey, this);
this.el.on("keypress", this.fireKey, this);
this.el.on("keyup", this.fireKey, this);





// reference to original value for reset

this.originalValue = this.getValue();
}
});
})
</script>





Thanks again. CYA