PDA

View Full Version : On click of "Enter" Key, the page gets refreshed.. This happens only in IE 9 ...



nalgo01
5 Nov 2012, 5:45 AM
Hi Geeks,

Need your thoughts on an issue, which is some what strange.

As part of my application i have used ValueBaseField for searching. This field accepts string and based on the string it search's in the DB. I have added a "Go" button which on clicked calls the "doSearch()" method which does the searching task for me.

I have also added an "EnterKeyDownEventHandler" event. This event also calls the "doSearch()" method. The above event was added for search DB when an user enters some value and clicks on enter button instead of "Go" button.

In both the case's , i.e click on "Go" button or "Enter" Button should search the DB.

Now the issue is...
On click of "Go" or "Enter" are fetching the data from the DB, but the problem here is ....
On click of "Enter" the page is getting refreshed ( It first displays the data and then refreshes ). This happens only in IE 9. In all other browsers and versions this is working fine. I.e there is no refresh.

But in IE 9, when clicked on "Enter" by adding some text in the ValueBaseField the page gets refreshed. which is very strange. I could not understand why this is happening.

Can some one help me understand why this is happening. I am unable to understand why this strange thing is happening.

Thanks in Advance,
gopi

tvanzoelen
6 Nov 2012, 2:39 AM
I don't know but IE9 fires changed events on textfield differently than other browsers. Mayby there is some kind of event that is picked up by the textfield.

For IE I have overriden .checkChangeEvents on textfields with an initComponent and added this




initComponent: function(){

if (Ext.isIE) {

if (Ext.isIE9) {
this.checkChangeEvents = ['change'];
}
else {
this.checkChangeEvents = ['change', 'input', 'textInput'];
}

}
else {
this.checkChangeEvents = ['change', 'propertychange'];
}

this.callParent();
}