PDA

View Full Version : Call to Msg.alert keeps focus from working



mozicodo
22 Oct 2010, 10:10 AM
I have the simple function below to check if a field is a number and if not display an alert and focus on that field. If I comment out the Ext.Msg.alert call or replace it with a standard javascript alert call, it works fine. But if I include the Ext.Msg.alert call then the field doesn't receive focus.


function checkNumberField(field, description)
{
var value = field.getValue();

if (isNaN(value) || (value == '') || (value == null)) {
Ext.Msg.alert("Input Error", "You must enter a number for " + description + ".");
field.fieldEl.dom.focus();
return 0;
}

return 1;
}