InputText returns null

0

Talk to people, I have a problem that I do not know what else to do. My idea was to have a checkbox that when dialing would show a field and unmark would hide this field, for this I used rendered and ajax, but when I mark this checkbox even if I write something in the input it shows the value sent is always null . Can you help me?

.XHTML

<h:panelGroup>
                    <b><h:outputText value="Possui Deficiência? " /></b>
                    <p:selectBooleanCheckbox
                        value="#{controllerAluno.alunoCadastrar.deficiente}"
                        id="checkDeficiencia" immediate="true">
                            <p:ajax event="change" update="campoEspecifique" />
                    </p:selectBooleanCheckbox>
                </h:panelGroup>
                <br />
                <h:panelGroup id="campoEspecifique">
                    <b><p:outputLabel value="Especifique:"
                            rendered="#{controllerAluno.alunoCadastrar.deficiente}"/> </b>
                    <p:inputText
                        rendered="#{controllerAluno.alunoCadastrar.deficiente}"                         
                        value="#{controllerAluno.alunoCadastrar.deficiencia}"/>                         
                </h:panelGroup>

MBean

public void inserir() throws Exception
{

    System.out.println("É Deficiente? " + this.alunoCadastrar.isDeficiente());
    System.out.println("Qual? " + this.alunoCadastrar.getDeficiencia());
    System.out.println("ID? " + this.alunoCadastrar.getId());
    System.out.println("Nome? " + this.alunoCadastrar.getNome());
    System.out.println("Sexo? " + this.alunoCadastrar.getSexo());
    System.out.println("Data? " + this.alunoCadastrar.getData_Nascimento());
    System.out.println("Turma? " + this.alunoCadastrar.getTurma().getDescricao());
    AdicionarMensagem.retornaInfo("Aluno Adicionado com Sucesso!");
    this.alunoCadastrar = new Aluno();
    AlunoNegocio an = new AlunoNegocio();               
    if (an.inserir(this.alunoCadastrar)) {
        AdicionarMensagem.retornaInfo("Aluno Adicionado com Sucesso!");
        this.alunoCadastrar = new Aluno();
    }   
}

This is what it generates, but I have given a value in the disability and will always null as I said earlier.

    
asked by anonymous 29.09.2016 / 22:12

2 answers

0

In your ajax put immediate :

<p:ajax event="change" update="campoEspecifique" immediate="true"/>
    
02.02.2017 / 17:40
0

Try to put like this in your ajax:

 <p:ajax partialSubmit="true" .... />
    
04.10.2016 / 14:58