Thursday, March 17, 2005
Tapestry in anger: pitfall #12141
You cannot validate your page when the form tag is in an embedded component because the IValidationDelegate.hasErrors() will not process the components form elements until it's too late.
So mypage.page (pseudo code)
submit button [w/listener=page.doit]
form element w/validator defined
IValidationDelegate delegate = (IValidationDelegate) getBeans().getBean("validator");
// INVALID: form elements in component has not asked to validate yet!
boolean save = !delegate.getHasErrors();
So I rewrote this so the form tag is in the page and now it works fine.