Hi,
We are developing one mobile application. It contains customer address information. In address inforamtion i have zip,phone number all are textboxes. I need number and alphabets validation for this. I try like this
function onlyNos(e) {
var evt = (e) ? e : window.event;
var charCode = (evt.keyCode) ? evt.keyCode : evt.which;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
};
function onlyAlphabets(e, t) {
try {
if (window.event) {
var charCode = window.event.keyCode;
}
else if (e) {
var charCode = e.which;
}
else { return true; }
if ((charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123))
return true;
else
return false;
}
catch (err) {
alert(err.Description);
}
};
@Html.TextBoxFor(model => model.LastName, new { @onkeypress = "return onlyAlphabets(event,this);" })
@Html.TextBoxFor(model => model.ZipPostalCode, new { @onkeydown = "return onlyNos(this);", minlength = "5", maxlength = "10", size = "10" })
But it is not working in mobile apps. Normal desktop its working fine but in mobile views it no working.
Can any one help me to do this textbox validations in mobile views.