PDA

View Full Version : Failed validation clears textfield value on hover



xjscrafter
11 Dec 2013, 6:42 PM
I have a textfield, and validator function to verify ip address was entered.

But if user focus out (get validation error), and then hover mouse pointer over field, sometimes (not always) the value in the textfield is cleared. I would prefer that the user clears the field and enters a correct value, not auto-cleared like this.


xtype : 'textfield',
itemId : 'txtIPAddress',
height : 30,
width : 401,
fieldLabel : 'Address',
allowBlank : false,
validator : function(v)
{
var ip = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
if(ip.test(v)) {
return true;
}
return "Enter a valid IP or domain address";
}

bricemason
16 Dec 2013, 11:45 AM
I'm not able to replicate this. I'm using Ext JS 4.2.1 with the following view:

Ext.define('MyApp.view.Main', {
extend : 'Ext.form.Panel',
xtype : 'main',


items : [
{
xtype : 'textfield',
itemId : 'txtIPAddress',
height : 30,
width : 401,
fieldLabel : 'Address',
allowBlank : false,
validator : function(v)
{
var ip = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
if(ip.test(v)) {
return true;
}
return "Enter a valid IP or domain address";
}
}
]
});


What version are you using? Can you post more of your code, specifically the entire form view which has that text field in it?

Brice

Kevin Jackson
17 Dec 2013, 5:48 AM
Which version of ExtJS are you using? What browser has shown the error? Have you been able to duplicate the issue on another browser? Is there a series of steps you can use to duplicate it? If this is intermittent the more you can tell us, the more likely that we can help.

xjscrafter
17 Dec 2013, 8:50 AM
4.2.2. But it looks like we were doing something in code on the activate event, when we should have been acting on the render event. So it works fine now.

Thanks for your response.