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