tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Wood (JIRA)" <...@tapestry.apache.org>
Subject [jira] Created: (TAPESTRY-2295) Select component should allow blank option and obey the required validator
Date Wed, 26 Mar 2008 05:21:24 GMT
Select component should allow blank option and obey the required validator

                 Key: TAPESTRY-2295
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2295
             Project: Tapestry
          Issue Type: Improvement
          Components: Core Components
    Affects Versions: 5.0.12
         Environment: osx 10.4, java 1.5
            Reporter: Julian Wood
            Priority: Minor

The situation is this:

I have a select box in a form, and I want to make it required.

This is simple enough, but the blank option disappears when the required validation is applied.
This is by design - the required validation is implemented so that a choice is always made.
As a corollary, the first option is always selected by default upon entry into the form.

The problem with this is that users have a tendency to skip these fields which are prepopulated,
something which when having a blank option (and required validation) does not happen. The
blank option should not necessarily be construed as the ability to let the user choose a null

If you add t:blankoption="always" to the select field, to restore the blank option, then the
required validation doesn't work on the client-side anymore (but does on the server-side).

One way to get around this problem is to make an entirely new component, identical to select,
with the exception of the _validate... line shown below:

    void beginRender(MarkupWriter writer) {
        writer.element("select", "name", getControlName(), "id", getClientId());

This causes the Tapestry.registerValidation(... method to include the field of interest, and
gives us the desired behaviour.

I think Select should be changed to at least allow this behaviour, if not to make it the default

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

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

View raw message