Hm... I've used this before when I ALWAYS want a field to be required, but I didn't see a way to make a field required or not required based on conditions that are only known when the page is rendered.
-----Original Message----- From: "Nikola Milikic" <nikola.mili...@gmail.com> Sent: Tuesday, May 24, 2011 11:44am To: "Tapestry users" <users@tapestry.apache.org> Subject: Re: dynamic validation for required / not required Hi Jack, Maybe Bean Validation can help you here http://tapestry.apache.org/bean-validation.html <http://tapestry.apache.org/bean-validation.html> Best, Nikola On Tue, May 24, 2011 at 5:30 PM, <jackkuros...@w9z.org> wrote: > I know I can make a field required like this: > <t:textfield value="myTextField" validate="required"/> > > But how can I make it programmatically determine whether or not the field > is required? > > I have tried: > > <t:textfield value="myTextField" validate="${validationText}"/> > > public String getValidationText() { > if (fieldRequired) { return "required" } > else { return ""} > > > But that doesn't seem to work. Tapestry says it can't coerce a string into > a Validator. > > Am I overlooking something simple or is there a better approach to > accomplish this? > > Jack > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org