Hi,

I was wondering whether it is possible to add Validators to a Tapestry field
(e.g., TextField) at render-time (based on a runtime property)? 

More specifically, I'd like to know whether I can avoid doing:

<t:if test="required">
  <t:textfield ... validate="a,b,c,required"> 
<p:else>
  <t:textfield ... validate="a,b,c"> 
</p:else></t:if>

and change it by something like

<t:textfield ... validate="a,b,c${prop:andRequired}" />

with 

public String getAndRequired {
  if(isRequired())
    return ",required";
  else
    return "";
}

in the page's java source (note: this code does not work).

I already thought of creating a custom 'required' validator, but there seems
to be no way to initialize it. I was thinking of initializing it in the tml
using t:validate="a,b,c,myrequired=${prop:required}", but this also doesn't
seem to work...

Thanks in advance

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to