public boolean validateField(FieldId _fieldIdToCheck)
{
boolean ret;
M_StudentTable stu;
TextBuffer txt = new TextBuffer();
str msg;
//msg = this.Name;
//txt.regularExpressions(true);
//txt.Appendtext(this.name);
//if(txt.find("^[A-Z]+$"))
//{
//stu.Name=this.Name;
//}
//else
//
//throw error ("String contains only alphabets");
//
ret = super(_fieldIdToCheck);
if (ret)
{
switch (_fieldIdToCheck)
{
case fieldNum(M_StudentTable,Sub1):
if(this.sub1 < 0)
ret=checkFailed("Marks shoud not less than 0");
else
if(this.sub1 >50)
ret=checkFailed("Marks shoud not exceed more than 50");
break;
case fieldNum(M_StudentTable,Sub2):
if(this.sub2 < 0)
ret=checkFailed("Marks shoud not less than 0");
else
if(this.Sub2 >50)
ret=checkFailed("Marks shoud not exceed more than 50");
break;
case fieldNum(M_StudentTable,Name):
msg = this.Name;
// txt.regularExpressions(true);
txt.Appendtext(this.name);
if(txt.find("^[A-Z]+$"))
{
if(strLen(msg)<3)
{
ret =checkFailed ("please enter more than 2 characters names");
break;
}
else
stu.Name=this.Name;
}
else
throw error ("Please Enter only alphabets");
break;
}
}
return ret;
}
{
boolean ret;
M_StudentTable stu;
TextBuffer txt = new TextBuffer();
str msg;
//msg = this.Name;
//txt.regularExpressions(true);
//txt.Appendtext(this.name);
//if(txt.find("^[A-Z]+$"))
//{
//stu.Name=this.Name;
//}
//else
//
//throw error ("String contains only alphabets");
//
ret = super(_fieldIdToCheck);
if (ret)
{
switch (_fieldIdToCheck)
{
case fieldNum(M_StudentTable,Sub1):
if(this.sub1 < 0)
ret=checkFailed("Marks shoud not less than 0");
else
if(this.sub1 >50)
ret=checkFailed("Marks shoud not exceed more than 50");
break;
case fieldNum(M_StudentTable,Sub2):
if(this.sub2 < 0)
ret=checkFailed("Marks shoud not less than 0");
else
if(this.Sub2 >50)
ret=checkFailed("Marks shoud not exceed more than 50");
break;
case fieldNum(M_StudentTable,Name):
msg = this.Name;
// txt.regularExpressions(true);
txt.Appendtext(this.name);
if(txt.find("^[A-Z]+$"))
{
if(strLen(msg)<3)
{
ret =checkFailed ("please enter more than 2 characters names");
break;
}
else
stu.Name=this.Name;
}
else
throw error ("Please Enter only alphabets");
break;
}
}
return ret;
}
No comments:
Post a Comment