The scenario
I had a field, it had typeahead enabled on an Xpage. This view has 6000 documents so a combo box was out of the question. I didnt really want to do a pick list either since most people know the number they want in the first place. But i needed a way to figure out if the value in the field existed in the view.
So i looked at adding a custom validator, couldn't seem to make that work. So i looked on the wiki and a few other places and discovered this. Create a validateExpression validator.
In the expression field you need to add your code to calculate to true or false. Syntax should be something like
return var1 == var2
Mine looked like
account1 = @Trim(@Text(document3.getItemValueString('job')));
chargetype = document3.getItemValueString('jobaccount');
db1 = new Array("notes1", "Applications\\viewpoint.nsf")
var iffound = ""
if(chargetype == 'Job')
{ iffound = @Trim(@Text(@DbLookup(db1,"Project Import",account1,1)));
return account1 == iffound
}
else
{return (@IsMember(account1, @DbColumn(db1,"Accounts7",1))!= 0)
}
Then here is the part i didn't get from the wiki post, You need to add a DisplayError control next to the field you are validating. Then set that displayerror to show error messages for that field you are validating. It will not pop up like the simple can not be 0 or can not be empty messages you get from the default validators.
Anyways I hope this helps someone else.
1 comments:
pmr #: 00157, 004
Post a Comment