I spent some days to try to validate part form with a OneSelect like as "Terms and Conditions", for example If are pre-filled Name and Telephone and I selected "Terms and Conditions" in this moment validate the previous fields are filled and enable "Next" button.
I tried using two ways, the first I put p:attribute inside p:selectOneRadio and received in method validateSelection() always null, the second is used validateSelection(String name, String telephone), but both methods show null values,
Does anyone know why this happens?
Thanks a lot.
(this is my view)
<h:form id="frmUser" enctype="multipart/form-data"> 
  <p:outputLabel id="lblName" for="txtName" value="#{msg.lbl_name}" styleClass="lbl8"/>     
  <p:inputText id="txtName" maxlength="7" required="true"  value="#{mainBean.userDTO.name}"/>
  <p:message for="txtName" display="text"/>
  <p:outputLabel id="lblTel" for="lblTel" value="#{msg.lbl_tele}" />    
  <p:inputText id="lblTel" maxlength="7" required="true"  value="#{mainBean.userDTO.telephone}"/>
  <p:message for="lblTel" display="text"/>
  <p:outputLabel for="console" value="Accept Terms and Conditions" />
    <p:selectOneRadio id="console"  unselectable="true" value="#{mainBean.selectTerms}">
    <f:selectItem itemLabel="Yes" itemValue="true" />
    <f:selectItem itemLabel="No" itemValue="false" />
    <f:attribute name="setname" value="#{mainBean.userDTO.name}" />     
    <p:ajax event="change" render="messagesSystem" update="messagesSystem" listener="#{mainBean.validateSelection}" />  
      <!--WAY TWO -- >
<!--
<p:ajax event="change" render="messagesSystem" update="messagesSystem" listener="#{mainBean.validateSelection(mainBean.userDTO.name,mainBean.userDTO.telephone)}" /> 
-->    
        </p:selectOneRadio>
</h:form>
This is my Bean
@Named("mainBean")
@SessionScoped
public class mainBean implements Serializable{
private  UserDTO userDTO;
  public String init() {
    userDTO = new UserDTO();
   //call url to display
  }
     /*
     * Getters y Setters
     * */   
    public UserDTO getUserDTO() {
        return userDTO;
    }
    public void setUserDTO(UserDTO userDTO) {
        this.userDTO = userDTO;
    }
   public void validateSelection(AjaxBehaviorEvent event) {
        System.out.println("fill name"+ userDTO.getName());
        System.out.println("fill name in ajax event :"+event.getComponent().getAttributes().get("setname"));
        UIComponent component = event.getComponent();
        System.out.println("fill name in ajax event component:"+
          component.getAttributes().get("setname"));
      //If two values are filled, eneabled NEXT BUTTON
    }
    public void validateSelection(String name, String telephone){
     System.out.println("fill name"+name);
      System.out.println("fill telephone"+telephone);
//If two values are filled, eneabled NEXT BUTTON
    }
}
And this is the UserDTO class
public class UserDTO implements Serializable{
    private String name;
    private String telephone;
    public UserDTO(){}
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getTelephone() {
        return telephone;
    }
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
}
