Monday, January 17, 2011

How to restrict string field to allow only alphabets in Axapta

At Form Level:
1) Form->design->StringControl->method->validate()

public boolean validate()
{
boolean ret;
;
if(strnfind(this.text(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ',1,strlen(this.text())))
{
info("enter only alfa");
}
else
{
ret = super();
}
return ret;
}

-------------------------------------------------------------------------------------

2) Form->design->StringControl->method-> textChange()

public void textChange()
{
   super();
   this.text(strkeep(this.text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
}

No comments:

Post a Comment

Leave your comments and solutins