tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ariel Pablo Klein" <apkl...@eml.cc>
Subject Proposal or Discussion: FieldLabel changes
Date Sun, 27 Mar 2005 19:55:37 GMT
Hi, I'm new on this list, I subscribed yesterday, but the reason that I
subscribed it's to propose some changes in form components if are voted or
can be discussed by us.
My English isn't so good, but I think that you can understand me.

Googling I found this demo:

Based on an article called "Simple Tricks for More Usable Forms".

first that I made to achieve this example on tapestry was:

1. I made on a copy of FieldLabel, it's to change the renderComponent
adjusting it to render <label> tag. I know that can be done on
validatedelegate labelprefix, but I think that this code has to be part of
fieldLabel component making it customizable by CSS like in the demo, and
associating FieldLabel to <Label> tag of HTML 4. 


2. I made visible isInError(IFormComponent component) on my own
ValidateDelegate because on ValidationDelegate is protected and isn't
visible by fieldlabel to know if a field has errors or not.
3. at this moment I made my own script file to achieve javascript
validation, but could be done by standardizing in all form components.

The code as you can imagine it's very simple:

        writer.attribute("for", field.getId());

        MyValidationDelegate myDelegate = ((MyValidationDelegate) delegate);
        if (myDelegate.isInError(field)) {
            writer.attribute("class", "problem");
        } else {
            IValidator validator = myDelegate.getValidator(field);
            if (validator != null && validator.isRequired())
                writer.attribute("class", "required");
                writer.attribute("class", "completed");

        if (getRaw()) {
        } else {


Maybe more things can be modified. But this could be the start of discussion
about this. 

Maybe in a near future validators could services too (sounds crazy :D) and
forms could be validated thru live validators.

Ariel Pablo Klein

To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org

View raw message