problem in validation script for whitespaces
Posted: Thu Nov 01, 2007 12:55 am
feyd | Please use
Please help me soon
Thanks
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello friends ..
i have a problem in my script
here is a snippet of javascript code which is for the checking of alphabetic fields only means only alphabates can be enter in the text fields .. but a problem is going on with this if user enters only alphabates then there should be no any error but users enters all the alphabates with white spaces then there is message coming only alphabtes are allowed , means this code is not considering white spaces as a alphabate so have a look on this code and give me idea what should i have to do for fixing my bug .............. here is the code : - >
[syntax="javascript"]
case "alphabetic":
case "alpha":
{
var charpos = objValue.value.search("[^A-Za-z]");
if(objValue.value.length > 0 && charpos >= 0)
{
if(!strError || strError.length ==0)
{
strError = objValue.name+": Only alphabetic characters allowed\n No Whitespaces ";
}//if
alert(strError + "\n [Error character position " + eval(charpos+1)+"]");
return false;
}//if
break;
}//alpha
Please help me soon
Thanks
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]