You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Franz Amador <fg...@yahoo.com> on 2008/01/03 23:35:54 UTC
T5.0.7: Custom validator for BeanEditForm field?
I'm having trouble figuring out how to do custom validation for a field created by BeanEditForm. In particular, I can't find the component id for such a field. The bean property name doesn't work. "beaneditform.<propertyname>" doesn't work either. I'd like to be able to use an onValidateFrom... method, but I don't know what to put after the "From". onValidate works, and I can then check the bean property and issue an error via the injected BeanEditForm, i.e.
@Component
private BeanEditForm beaneditform;
void onValidate() {
if (!isInState(bean.getAddress()))
beaneditform.recordError("Can't be out of state");
}
but since I don't know the component id, I can't use the version of recordError that would mark the errant field. It looks like I could define and register a custom validator, but that seems like overkill for one field. Any help much appreciated.
Franz Amador
fgamador@yahoo.com