4
I have a <p:hotkey>
which is the Primefaces component for working with shortcuts. Every time I press Ctrl + 1 two new fields appear on the page but I would like every time I press this combination the data that is in imputText
Codigo
and Descrição
are added to a list.
For example, I squeeze Ctrl + 1 two new fields appear and the values of the first fields are added in a list. I am trying as follows:
Campos:
<p:outputLabel value="Código Serviço" />
<p:inputText id="codigoServico" size="40" value="#{cadastroReembolsoBean.servico.codServico}"/>
<p:outputLabel value="Descrição" />
<p:inputText id="descricaoServico" size="46" value="#{cadastroReembolsoBean.servico.descricao}"/>
Hotkey:
<p:hotkey bind="ctrl+1" handler="desenvolvimento()"></p:hotkey>
<p:remoteCommand name="desenvolvimento"
action="#{cadastroReembolsoBean.adicionarCodigos()}" immediate="true"
update="pnlCadastroServico"></p:remoteCommand>
Method adicionarCodigos
:
public void adicionarCodigos() {
if (contador < 0) {
contador = 0;
}
solicitacao.getListaServicos().add(servico);
System.out.println("Serviço Adicionado: "+solicitacao.getListaServicos());
contador++;
}
Notice I have one System.out.println
that shows the listaServicos
, but it is coming null. That is, it is not taking the values of the imputText
. How can I get these values when entering with the shortcut?
Just to make sure I understand... When using the shortcut will fill the item with the data
input
and the same item will be added to the list?– Luídne
When I use the shortcut it takes input data and plays in a list
– DiegoAugusto