Ahh....I really need to finish up the 4.1 release. We'll be able to support
arbitrary requirements logic like this now as well. (on the client side &&
server.. Ie if this field gets filled out/selected then these other two
fields are required. Stuff like that)

On 7/3/06, Richard Clark <[EMAIL PROTECTED]> wrote:

You can either:
1) Do all the validation in your listener (on the Java side), or
2) Write your own client-side valdation code in JavaScript.

The server-side validation would look like this:

ValidationDelegate delegate =
(ValidationDelegate)getComponent("delegate");
if (!getCheckbox()) {
  String firstName = getFirstName(); // @Text component bound to firstName
  if (firstName == null || firstName.length() == 0) {
    delegate.setFormComponent
((IFormComponent)getComponent("inputFirstName"));
    delegate.record("Please supply a first name",
ValidationConstraint.REQUIRED);
  }
}
if (delegate.getHasErrors()) return;


...Richard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Reply via email to