java - Primefaces call ConfirmDialog from Backing -


I would like to call confirmDialog via backing This code works perfectly, But how can I set the message and set the installDialog implementer through backing? There are two conditions, while:

  • Check Option A on the user checkbox (I left the code), then it should print the text directly to the console. - & gt; This is done by a code given below
  • If the user checks option B on the check box, then this confirmation should be shown DEOLOug and when the user clicks the button, then the second function on the backing Should call.

    How to do this? Thank you.

      & lt; P: command button value = "execute" icon = "ui-icon-circle-check" update = "frmContent" actionoff = "# {backing.validate}" /> & Lt; P: confirmDialog id = "cfmDlg" widgetVar = "wvCfmDlg" global = "true" & gt; & Lt; P: command button value = "yes" type = "button" style class = "ui-confirmdialog-yes" icon = "ui-icon-check" /> & Lt; P: Command Button Value = "No" Type = "Button" style class = "ui-confirmdialog-no" icon = "ui-icon-close" /> & Lt; / P: confirmDialog & gt;   

    In backup:

      Validate the public null (if (mode.equals ("1") {System.out.println ("OK" );} Other {// Call Confirmation and Set Message + Action Listener RequestContext Reference = RequestContext.getCurrentInstance (); context.execute ("wvCfmDlg.show ();");}}   < / Div> 

    If I understood my question correctly ... then I will do it like this.

    < Strong> XHTML

      & lt; p: command button style = "display: none" widgetVar = "confirmButton" ActionListener = "# {backing .yesFunction} "& gt; & lt; p: Push "Header =" Confirmation "message =" Are you sure? "/ & Gt; & lt; / p: CommandButton & gt; & lt; p: Command button value =" Execute "actionnon =" # {backing.validate} "/>  <: value of command button =" No "/>    

    Been

      public valid valid () {if (mode.equals ("1 ")) {System.out.println (" OK "); } Other {RequestContext reference = RequestContext.getCurrentInstance (); Context.execute ("pf ('confirmButton') jq.click () ;."); }}   

    Basically you add hidden buttons in general (with P: Confirm) and you click it through jQuery.

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -