//Sorry, I somehow split my example code. See code below. 

Hello, I have a component that has a markupWriter in it. I'm trying to
figure out how to validate the hidden field created by the MarkupWriter. The
field needs to be dynamically validated, so I'm using something like below
to determine validation requirements. 

page class

    @Inject
    private FieldValidatorSource source;
    
    @InjectComponent
    private Field authorizer; 

    public FieldValidator getAuthorizerValidator() {
        String validationString = "none";
        if(attributeDefinition.isRequired()) {
            validationString = "required";
        }
        //source is FieldValidatorSource
        return source.createValidator(authorizer, validationString, null);
    } 

Page.tml

    <t:CustomField t:id="authorizer" t:value="pr.authorizer"
t:validate="prop:authorizerValidator" encoder="applicationUserEncoder"/>

Component.java

        @Override
        public void render(final MarkupWriter w) {

w.element ("input", "type", "hidden", "id", this.clientId + "HiddenField",
"name",
this.controlName + "HiddenField", "class", this.clientId, "title",
splitCamelCase(this.clientId));
w.end();
    



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Add-Tapestry-validation-to-hidden-element-written-with-MarkupWriter-tp5710353.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