public boolean validateWrite()
{
boolean ret;
int q;
int ascii;
int i;
q= strLen(Mobile.Phone);
ret = super();
if(Mobile.Phone)
{
for (i=1; i<=q; i++)
{
ascii = char2num(Mobile.Phone, i);
if( ascii >= 48 && ascii <= 57)
ret = true;
else
{
ret = false;
error('Phone Number must be numeric only');
break;
}
}
if(q!=10)
{
error('Phone Number must be of 10 digits');
Mobile.Phone = "";
Mobile.insert();
}
}
return ret;
}
{
boolean ret;
int q;
int ascii;
int i;
q= strLen(Mobile.Phone);
ret = super();
if(Mobile.Phone)
{
for (i=1; i<=q; i++)
{
ascii = char2num(Mobile.Phone, i);
if( ascii >= 48 && ascii <= 57)
ret = true;
else
{
ret = false;
error('Phone Number must be numeric only');
break;
}
}
if(q!=10)
{
error('Phone Number must be of 10 digits');
Mobile.Phone = "";
Mobile.insert();
}
}
return ret;
}
No comments:
Post a Comment