Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8198419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:56:51+00:00 2026-06-07T05:56:51+00:00

I have jQuery UI confirm dialog: function fnComfirm(title, content) { $(#dialog:ui-dialog).dialog(destroy); $(#dialog-confirm p).html(content); $(#dialog-confirm).dialog({

  • 0

I have jQuery UI confirm dialog:

function fnComfirm(title, content) {
    $("#dialog:ui-dialog").dialog("destroy");
    $("#dialog-confirm p").html(content);
    $("#dialog-confirm").dialog({
        title: title,
        resizable: false,
        height: 200,
        width: 486,
        modal: true,
        buttons: {
            "OK": function() {
                $( this ).dialog("close");
                return true;
            },
            Cancel: function() {
                $( this ).dialog("close");
                return false;
            }
        }
    });
}

Called by JSF2 html:

<a4j:commandButton action="#{userBean.makeSomething()}"  type="button" onclick="if (fnValidateUsersList()) {return fnComfirm('Delete User', 'Bla bla')}" />

But I can’t get true/false value from this function. I saw many questions here on this site about it, tried all of them, but still get no success.

UPDATE:
output of <a4j:commandButton>:

<input type="button" value="Make Something" onclick="jsf.util.chain(this,event,&quot;if (fnValidateUsersList()) {return fnComfirm('Delete User', 'Bla bla')}&quot;,&quot;RichFaces.ajax(\&quot;frm:j_idt25\&quot;,event,{\&quot;incId\&quot;:\&quot;1\&quot;} )&quot;);return false;" name="frm:j_idt25" id="frm:j_idt25">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:56:52+00:00Added an answer on June 7, 2026 at 5:56 am

    Here an approach that I use (You can take the general idea for your example)

    You need two buttons

    First one will be hidden and will be called as a result of clicking Yes in the confirm dialog, this hidden button will be the one that will call the server side method and will do the render using the f:ajax

    <h:commandButton id="myHiddenButtonID" value="DeleteHiddenButton" action="#{userBean.makeSomething()}" style="display:none">
        <f:ajax render="@form" ></f:ajax>
    </h:commandButton>
    

    Second button will open the dialog, this button will also submit the form to the server with execute="@form" (in case you have selection column in table (select several columns in table and click button to delete) that you want to to update in the server bean for example)

    <h:commandButton value="Delete">
        <f:ajax execute="@form" onevent="openDialogFunc()"></f:ajax>
    </h:commandButton>
    

    now to the implementation of the js function

    function openDialogFunc(data){
        if (data.status === 'success') {
            $('#dialog').dialog({
                        title: title,
                        resizable: false,
                        height: 200,
                         width: 486,
                         modal: true,
             buttons: {
                     "Ok": function() { 
                         $("#myHiddenButtonID").click();
                         $(this).dialog("close"); 
                     }, 
                     "Cancel": function() { 
                         $(this).dialog("close"); 
                     } 
                 }
             });
        }
    }
    

    Notice that only upon clicking the OK dialog button there will be an execution of your hidden button $("#myHiddenButtonID").click(); otherwise nothing will happen…

    took this from similar question that I have answered in the past How to implement JQuery confirm dialog with JSF

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this jquery code: $(#deletec-box).dialog({ autoOpen: false, resizable: false, height:230, modal: true, buttons:
The problem is I have this piece of code (Jquery UI): $(#dialog-confirm).dialog({ resizable: false,
I have an HTML link that opens a jQuery modal dialog which contains an
I have a jquery dialog that uses a non-jquery javascript function to complete the
I am using SimpleModal in jQuery, and I have one confirm dialog. If the
I have a link to delete action using Jquery dialog confirm message. Clicking on
I have a jQuery dialog that posts a form when the Please Confirm button
I have the following link which opens a jquery modal window: <div id='confirm-dialog'><a href='#'
because the way jquery dialogs woks, when using a confirm dialog, you have to
I have JQuery UI Dialog opening on pressing CTRL + Q using the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.