You are still not getting the point...

1. fieldValidationSupport,validate is the service responsible for validating
a field. It requries a FieldValidator which is passed as a parameter to it.
If this @Parameter validate is null, as is the case with RadioGroup,
fieldValidationSupport is never called as the source shows

if (validate != null)
   fieldValidationSupport.validate(rawValue, resources, validate);

2. In other components like Select, if @Parameter validate is not provided a
default is chosen. The default is provided by ComponentDefaultProvider which
in turn calls FieldValidatorDefaultProvider which uses FieldValidatorSource
for creating default validators based on the field annotations and type.

in case of Select we have default validate like this

Binding defaultValidate()
    {
        return defaultProvider.defaultValidatorBinding("value", resources);
    }

so if we don't provide a validate, the default is chosen


Now in a RadioGroup as the code does not use a default in case @Parameter
validate is not provided, the field annotations are not taken into
consideration

regards
Taha

On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski <zimowsk...@gmail.com> wrote:

> Hi Taha -
>
> I agree with you it seems to be a bug, and I (think) I get what you are
> saying.
>
> However, I am having a hard time seeing why the bug would be in
> RadioGroup processSubmission() or anywhere in the RadioGroup class for
> that matter.
>
> Rather, it seems the bug (if exists) is deeper in the chain, where the
> @Validate annotation is read off of a bean and applied to a
> RadioGroup.
>
> I believe this because RadioGroup *does* behave correctly if TML defines:
>
> <t:radiogroup validate="required">
>
> but now when the @Validate("required") is on the bean.
>
> Adam
>
>
> On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez <tawus.tapes...@gmail.com>
> wrote:
> > it is the @Parameter validate in RadioGroup that is required not
> @Validate
> > as that is never checked in case @Parameter validate is not given in a
> > RadioGroup ... Please read my answer again :)
> >
> > It seems to be bug!!
> >
> > regards
> > Taha
> >
> > On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski <zimowsk...@gmail.com>
> wrote:
> >
> >> Thanks Taha, but I did supply @Validate("required") annotation and
> >> validation did not happen.
> >>
> >> Adam
> >>
> >> On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez <tawus.tapes...@gmail.com>
> >> wrote:
> >> > Hi
> >> >
> >> > 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.
> >> >
> >> > regards
> >> > Taha
> >> >
> >> >
> >> > On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski <zimowsk...@gmail.com>
> >> wrote:
> >> >
> >> >> I have a bean where @Validate("required") does not work on a
> >> >> radiogroup, but <t:radiogroup validate="required" ...   does. Other
> >> >> @Validate annotated fields (TextField's) work. My companyType is
> >> >> purposely set to null by default, as I do not want any radio
> >> >> pre-selected, thus it shall be required.
> >> >>
> >> >> Is @Validate in the context I have defined supposed to work on the
> >> >> radio group as well?
> >> >>
> >> >> /**
> >> >>  * @author Adam Zimowski
> >> >>  */
> >> >> public class RegisterUiBean {
> >> >>
> >> >>        @Validate("required")
> >> >>        private String email;
> >> >>
> >> >>        @Validate("required")
> >> >>        private String emailRetype;
> >> >>
> >> >>        @Validate("required")
> >> >>        private String password;
> >> >>
> >> >>        @Validate("required")
> >> >>        private String passwordRetype;
> >> >>
> >> >>        @Validate("required")
> >> >>        private CompanyType companyType;
> >> >>
> >> >>
> >> >>        public RegisterUiBean() {
> >> >>        }
> >> >>
> >> >>        public String getEmail() {
> >> >>                return email;
> >> >>        }
> >> >>
> >> >>
> >> >>        public void setEmail(String aEmail) {
> >> >>                email = aEmail;
> >> >>        }
> >> >>
> >> >>
> >> >>        public String getEmailRetype() {
> >> >>                return emailRetype;
> >> >>        }
> >> >>
> >> >>
> >> >>        public void setEmailRetype(String aEmailRetype) {
> >> >>                emailRetype = aEmailRetype;
> >> >>        }
> >> >>
> >> >>
> >> >>        public String getPassword() {
> >> >>                return password;
> >> >>        }
> >> >>
> >> >>
> >> >>        public void setPassword(String aPassword) {
> >> >>                password = aPassword;
> >> >>        }
> >> >>
> >> >>
> >> >>        public String getPasswordRetype() {
> >> >>                return passwordRetype;
> >> >>        }
> >> >>
> >> >>
> >> >>        public void setPasswordRetype(String aPasswordRetype) {
> >> >>                passwordRetype = aPasswordRetype;
> >> >>        }
> >> >>
> >> >>
> >> >>        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;
> >> >>        }
> >> >> }
> >> >>
> >> >>  <div class="kk-hdr">Registration Information</div>
> >> >>  <div class="kk-row">
> >> >>  <div class="kk-label"><t:label for="r_email1"/> :</div>
> >> >>  <div class="kk-field"><t:textfield t:id="r_email1"
> >> >> value="registration.email"/></div>
> >> >>  <t:error class="literal:kk-error" for="r_email1"/>
> >> >>  </div>
> >> >>  <div class="kk-row">
> >> >>  <div class="kk-label"><t:label for="r_email2"/> :</div>
> >> >>  <div class="kk-field"><t:textfield t:id="r_email2"
> >> >> value="registration.emailRetype"/></div>
> >> >>  <t:error class="literal:kk-error" for="r_email2"/>
> >> >>  </div>
> >> >>  <div class="kk-row">
> >> >>  <div class="kk-label"><t:label for="r_pass1"/> :</div>
> >> >>  <div class="kk-field"><t:textfield t:id="r_pass1"
> >> >> value="registration.password"/></div>
> >> >>  <t:error class="literal:kk-error" for="r_pass1"/>
> >> >>  </div>
> >> >>  <div class="kk-row">
> >> >>  <div class="kk-label"><t:label for="r_pass2"/> :</div>
> >> >>  <div class="kk-field"><t:textfield t:id="r_pass2"
> >> >> value="registration.passwordRetype"/></div>
> >> >>  <t:error class="literal:kk-error" for="r_pass2"/>
> >> >>  </div>
> >> >>  <div class="kk-row">
> >> >>  <div class="kk-label"><t:label for="r_type"/> :</div>
> >> >>  <div class="kk-field">
> >> >>  <t:radiogroup t:id="r_type" value="registration.companyType"
> >> >> validate="required">
> >> >>        <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>
> >> >>  </div>
> >> >>
> >> >> Adam
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to