validator onbefore