You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org> on 2008/08/19 19:13:45 UTC

[jira] Updated: (TAPESTRY-2295) Select component should allow blank option and obey the required validator

     [ https://issues.apache.org/jira/browse/TAPESTRY-2295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship updated TAPESTRY-2295:
-------------------------------------------

    Assignee:     (was: Howard M. Lewis Ship)

> 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: tapestry-core
>    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 value.
> 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());
>         _validate.render(writer);
>         _resources.renderInformalParameters(writer);
>     }
> 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 behaviour.

-- 
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