To restrict values to be entered in a field

Hi, 

I need to restrict the user not to subscribe more than 4 books:

I done it using as following method:

public boolean aosValidateInsert()
{
boolean ret;
AX_SubscriberMaster axsm;
AX_TransactionHeader axt;
AX_TransactionLine axtl;
;
ret = super();
select count(recId) from axtl where axtl.Trans_Id == this.Trans_Id;
if(axtl.recId > 3)
ret = checkFailed("User can't subscriber more than 4 books");
return ret;
}

wat dis method doing is after I entered the 5th value it showing warning.
So I want to make the table from entering the 5th value.

How can I do tat?
Thanks.

Related
Recommended