0
votes

I'm working with primefaces mobile(0.9.2 - jsf2), and I have a strange problem. I have a view with 2 buttons, one to add and another to save the order. the add button works fine, but when I click on the save button, instead of call the save method, it goes first to the method add and after it goes to save method. Anyone have a tip? thank you..

...<div class="field-input" >
                        <p:commandButton action="#{pedidoMobileBean.adicionaProduto()}" id="pcbAdd" value="Adicionar" update="hpgItens hpgTotais hpgTipoBonificacao"  icon="plus" iconPos="left" ></p:commandButton>                                
                    </div>
                    <div class="label-input"></div>
                     <div class="field-input">
                    <p:commandButton action="#{pedidoMobileBean.salvar()}" ajax="true" id="pcbSave" value="Salvar" update="hpgPedidoV3 :Form:hpgPedidoV1" ></p:commandButton>

                    </div>...
1
Sounds weird, could you please give us some hints, may be a bit more about your form and a few more line of codes from your bean? I can't see anything wrong with your code.Alexandre Jacob
Olá! I guess the problem here is that you are updating the form and since the first button has ajax="false" when you call the save button it will reload the entire form and call that method again.RuntimeError

1 Answers

0
votes

Try adding the process-attribute to your save-button:

<p:commandButton ajax="true" process="@this" ..../>