You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2014/05/27 09:20:32 UTC

[jira] [Updated] (TAP5-1513) @Validate on RadioGroup not applied

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

Jochen Kemnade updated TAP5-1513:
---------------------------------

    Labels: bulk-close-candidate  (was: )

This issue has been last updated about 1.5 years ago, has no assignee, affects an old version of Tapestry that is not actively developed anymore, and is therefore prone to be bulk-closed in the near future.

If the issue still persists with the most recent development preview of Tapestry (5.4-beta-6, which is available from Maven Central), please update it as soon as possible. In the case of a feature request, please discuss it with the Tapestry developer community on the dev@tapestry.apache.org mailing list first.


> @Validate on RadioGroup not applied
> -----------------------------------
>
>                 Key: TAP5-1513
>                 URL: https://issues.apache.org/jira/browse/TAP5-1513
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.2
>            Reporter: Adam Zimowski
>            Priority: Minor
>              Labels: bulk-close-candidate
>
> Given some bean with property which is mapped to a radio group, and a @Validate("required") annotation on it, Tapestry is not reading the @Validate annotation for such property.
> Complete Thread: http://tapestry.1045711.n5.nabble.com/T5-Validate-on-RadioGroup-td4299105.html
> Example:
> public class RegisterUiBean {
>  @Validate("required")
>  private CompanyType companyType;
>       public CompanyType getCompanyType() {
>                return companyType;
>        }
>        public void setCompanyType(CompanyType aCompanyType) {
>                companyType = aCompanyType;
>        }
>        public CompanyType getCorporation() {
>                return CompanyType.Corporation;
>        }
>        public CompanyType getFederalGov() {
>                return CompanyType.FederalGovernment;
>        }
>        public CompanyType getStateGov() {
>                return CompanyType.StateGovernment;
>        }
>        public CompanyType getIndividual() {
>                return CompanyType.Individual;
>        }
> }
> <t:radiogroup t:id="r_type" value="registration.companyType">
>        <t:radio t:id="corporation" value="registration.corporation"/>
>        <t:label for="corporation"/>
>        <t:radio t:id="federalGovernment" value="registration.federalGov"/>
>        <t:label for="federalGovernment"/>
>        <t:radio t:id="stateGovernment" value="registration.stateGov"/>
>        <t:label for="stateGovernment"/>
>        <t:radio t:id="individual" value="registration.individual"/>
>        <t:label for="individual"/>
>  </t:radiogroup>
> Page:
> 	@Persist
> 	@Property
> 	private RegisterUiBean registration;
> Taha said:
> I compared the code from RadioGroup with that of Select and found the
> following difference
> In Select if parameter 'validate' is not given a default is chosen and so it
> is never null. Validation is performed
> in processSubmission() method by the line
> fieldValidationSupport.validate(selectedValue, resources, validate);
> In RadioGroup however, there is no defaultValidate(){} and so validate can
> be null. Now the validation here is done by the line
> if (validate != null)
>   fieldValidationSupport.validate(rawValue, resources, validate);
> so when the validate parameter is not supplied, validation does not happen.
> Given above information, I patched up RadioGroup by adding:
>    Binding defaultValidate()
>    {
>        return defaultProvider.defaultValidatorBinding("value", resources);
>    }
> and now the @Validate annotation on my bean enum property is read in
> correctly. So this is the bug in RadioGroup, which is missing the
> above as you pointed out.



--
This message was sent by Atlassian JIRA
(v6.2#6252)