On Wed, 25 May 2011 00:41:48 -0300, <jackkuros...@w9z.org> wrote:

Thanks Josh and Thiago!

:D

Here is what I ended up with in case it helps anyone else:

    public FieldValidator getFieldValidator() {
        String validationString = "none";
        if(attributeDefinition.isRequired()) {
            validationString = "required";
        }
        Field f = null;
//isUseTextField just tests to see if the attribute is defined to be
        // over 50 chars or not
        if(isUseTextField()) {
f = (Field)componentResources.getEmbeddedComponent("attributetextfield");
        } else {
f = (Field)componentResources.getEmbeddedComponent("attributetextarea");
        }
        //source is FieldValidatorSource
        return source.createValidator(f, validationString, null);

    }

Have you tried using @InjectComponent instead of getEmbeddedComponent()? Your solution is correct, but using @InjectComponent would be a little easier and more elegant.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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

Reply via email to