I'm trying to prevent the user from entering text input in a certain field.Now i'm using extjs panels, and i'm giving the function the record of the panel. The variable phone is being extracted, but i'm not being able to check it if it's formed completely of numbers or not. Any help please?
function saveHiring(record){
var phone = record.getField("PHONE_NUMBER").getRealValue();
var charCode = (phone.which) ? phone.which : phone.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57)){
alert('no');
}
else{
alert('yes');
}
}