0

I would like to display in a dialog the number inserted in the inputText.

<p:inputText id="nbr"
             type="number" 
             value="#{MB.number}" 
             required="true" 
             label="nbr" />
<p:confirmDialog id="confirmPurchase" 
                 message="Your Database was successfully created. And contains "
                 appendToBody="true" 
                 header="Buy Emails List" 
                 severity="info" 
                 widgetVar="purchase">  
    <a class="boldtext">  
       #{MB.number} 
       <h5> datas</h5> 
    </a>
    <p:commandButton id="confirm" value="Buy"  actionListener="#{MB.buy())}" />  
    <p:commandButton id="decline" 
                     value="Decline" 
                     onclick="purchase.hide();" 
                     type="button" />  
</p:confirmDialog> 

The code below returns always 0 as a number in the confirm dialog.

Update1

the dialog is showing once the action in the commandButton is completed

  <p:commandButton value="Extract" update="table nbr" id="ajax" ajax="true" widgetVar="extractButton action="#{MB.search()}" oncomplete="purchase.show();"/>  
2
  • How exactly are you updating the dialog's content with the submitted number and then opening it? I'm not seeing that anywhere in the code.
    – BalusC
    Dec 5, 2013 at 10:07
  • I'm still not seeing anywhere how you're updating the dialog's content. I only see table and nbr being updated by the command button, but they do not cover the dialog's content which you apparently needed to update. How exactly did you expect the dialog's content to be updated...? By magic?
    – BalusC
    Dec 5, 2013 at 10:49

1 Answer 1

1

First of all, you need a <h:form/> around your <p:inputText> and your <p:commandButton>.

Your <p:commandButton> should have the attribute update=":outputUserText".

Inside your Dialog, you need a <p:outputLabel id="outputUserText" value="#{MB.number}"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.