View Full Version : Switiching between languages

07-22-2010, 01:56 PM
please i want to know if there is a possibility to force the user to type english characters
coz i made all my web site in arabic and germany languages

i want to force user to type the username and password in english characters

any ideas?

07-22-2010, 02:11 PM
There may be a neater way, but you could just make a string containing all legal characters and check that each character of the username and password appears in the string.

Assuming engChars is your string of all legal characters:

function checkEngChars(str) {
for(var i=0; i<str.length; i++) {
if(engChars.indexOf(str.charAt(i))==-1) {
return false;

return true;