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: [email protected]
For additional commands, e-mail: [email protected]