Javascript Confirm popup Yes, No button instead of OK and Cancel?

Hi,
I wrote javascript for confirm popup like below:
var answer = confirm ("Are you sure you want to delete this item ?");
It is showing OK Cancel button popup , but I want to display Yes No buttons on popup insted of OK Cancel buttons...
Appreciate if anyone give proper solution.
Thank you.
Still I could not get proper solution.... Please any one help me solve this... need js solution not jquery..

Hi Praveen
There is not direct option in JavaScript to get Yes/No buttons in a Confirm dialog.
But, we can create a customized dialog box with our own HTML tags, controls and scripts and show it as a confirmation dialog using
window.showModalDialog() function
Here is the sample HTML to demonstrate how to create a customized confirmation dialog.
Dialog.HTML (This contains the UI for the confirmation dialog. Message, Yes No buttons etc)
<!DOCTYPE>
<html>
<head>
<title>Confirmation Message</title>
<script language="javascript" type="text/javascript">
window.onload = function()
var messageDiv = document.getElementById('dlgMessage');
if ( messageDiv != null && typeof(messageDiv) != "undefined" )
messageDiv.innerHTML = window.dialogArguments;
function confirmClick(args)
window.returnValue = args;
window.close();
</script>
</head>
<body>
<div id="dlgMessage">
</div>
<input type="button" value="Yes" id="btnYes" onclick="javascript:confirmClick('yes')"/>
<input type="button" value="No" id="btnNo" onclick="javascript:confirmClick('no');"/>
</body>
</html>
MainPage.HTML (From where the confirmation dialog will be shown. In your case, u can use the script in this html and customize it according to ur needs)
<!DOCTYPE>
<html>
<head>
<title>Main Page</title>
<script language="javascript" type="text/javascript">
function showConfirmDlg(message)
var returnValue = window.showModalDialog("dialog.html",message,"dialogHeight:150px;dialogWidth:200px");
if ( returnValue == 'yes' )
alert('Yes button is clicked in the dialog');
else
alert('No button is clicked in the dialog');
</script>
</head>
<body>
<input id="btnConfirm" type="button" value="Confirm" onclick="javascript:showConfirmDlg('Do you want to continue?');" />
</body>
</html>
Hope this helps.
See this MSDN Link for more information on how to use and customize the showModalDialog() function
http://msdn.microsoft.com/en-us/library/ie/ms536759(v=vs.85).aspx

Similar Messages

  • Call a process based on the click of a javascript confirm popup box

    I have created a function to create a javascript confirm popup box which calls an update process called Reactivate_save(), see below:
    function reactivate_save()
    var r=confirm("Do you wish to save pending changes?")
    if (r==true)
    document.getElementById('Reactivate_Save').call();
    I want to make the update process conditional on clicking the 'ok' button inside the popup box.....Is this possible?
    I thought that I could reference it by using:
    value in expression 1 = expression 2
    reactivate_save() = true or 1
    Neither of these worked and wondering if there is something else that I can use?
    Thanks,
    Chris

    Hi,
    Your function is in Javascript while the process is PL/SQL. What you need to do is somewthing like this
    if (r==true)
    document.getElementById('Reactivate_Save').call(); // not sure what this does so left it as it is
    doSubmit('MY_REQUEST');
    }You can now use the 'MY_REQUEST' request, or whatever else you choose to call it, in the process condition using
    1. Request = e condition type by entering MY_REQUEST in the Expression 1
    or
    2. PL/SQL Expression type with :REQUEST = 'MY_REQUEST' in expression 1
    Note : In Apex 3 and below you need to add a semi colon at the end of PL/SQL Expresssions
    Regards,
    PS : Noticed that this is the same as call a process based on the click of a javascript confirm popup box
    Edited by: Prabodh on Sep 28, 2010 9:05 PM

  • Javascript confirm() with Yes/No?

    Is it possible to get "Yes" and "No" for the two buttons
    rather than "OK"
    and "Cancel"?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================

    Thanks!
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "bregent" <[email protected]> wrote in
    message
    news:g8hd2e$dei$[email protected]..
    > >That's a nice link, but 91K of CSS? Wow. Have you
    used this method?
    >
    > Nope. Just searched for it when you asked. I haven't
    looked to closely but
    > that link is to a site for foundation library, which I
    assume is also
    > required.
    > I'm betting there are some bare bones examples out there
    you can copy if
    > you
    > look around. I'll post back if I find any.
    >

  • How to Add A Javascript Confirm() on an Apex button for a form?

    Hi, how can I add a Javascript confirm() to a button in Apex for a form? Thanks.

    Hello:
    You could do the following
    1)In the 'Option URL Redirect' section of the Edit Button page set 'Target is a ' to 'URL'
    2)For URL Target enter javascript:{if (confirm('Your Question here')) doSubmit('<button name>');}Varad
    Edited by: varad acharya on Jul 15, 2009 3:47 PM

  • HTTPUNIT - How to click OK on a javascript confirm popup

    Hi all,
    I'm new using httpunit. I've to test a webpage that deletes an item. When you click on the delete button, a confirmation's popup is shown with two buttons (Accept and reject). To go on testing the whole website, I need to click on the accept button and I don't know how to do this. Could anyone help me please?
    Let me type some code to ilustrate the case.
    //This is the delete button as is written in the html's form tag
    buch of code
    <input type="button" class="button" value="delete" onclick="verify.onBorrar(this.form)"/>
    bunch of code
    //This is the javascript that handles the onclick event
    function verify_onBorrar(form){
    for(var i = 0;i<form.selection.length;i++){
    if(form.selection[i].checked){
    if(confirm('blablabla'){
    form.action = 'ConsAlmBorrar.jsp?';
    form.submit();
    verify.onBorrar = verify_onBorrar;
    note that selection is the name of a group of radio buttons
    With the httpunit java class that I've made, I'm able to select the item I want to delete, click on the delete button, and here is where the popup window appear and I can't go further.
    Thank you Indeed.

    Hi Maciejhttp://forums.adobe.com/people/Maciej%20Przepi%C3%B3ra
    Thanks for your inputs.
    I have memory leaks in my code. I have tried iDialog->Release() code which reduces some of the memory leaks
    Though I want to use more clean method of InterfacePtr.
    "To prevent reference counts  from incrementing, as in Type 1a and 1b, use this constructor, which does not  call IPMUnknown::AddRef:"
    Which Constructor you are pointing out, I didn't get it.
    I tried InterfacePtr<IDialog> iDialog((IDialog *)iWidgetParent->QueryParentFor(IID_IDIALOG));
    It started giving me assert again.
    Please give an example how to do it or which InterfacePtr constructor doesn't call AddRef().
    Many thanks for helping me with this.
    D

  • Javascript confirm() popup freezes everytime

    Since the latest update to Firefox (3.6.4), 3 of our users have reported that Firefox crashes when calling a confirm() dialog. The dialog appears but no buttons work and the dialog cannot be moved or closed, and the process seems to have hung.
    We have tried Safe Mode and the problem persists.
    The HTML page in question, with the confirm() call, is a local file with one embedded Flash applet.
    After about 30 seconds of waiting and clicking around, the process suddenly recovers and acts normally from then on.
    Anyone else having this problem?

    additionally, i want to add that the problem does not occur on all confirm() calls, for instance this one works fine:
    http://www.tizag.com/javascriptT/javascriptconfirm.php

  • I create a new Sync account but the sync options button doesn't work, there's a "Finish" button instead of Next, and when I click it, nothing happens. v13.0

    Screenshot of the setup screen
    [http://i23.photobucket.com/albums/b390/dbenjamin1990/firefoxsync.png]

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Popup witth: question, table and YES/NO buttons

    Hi there. Maybe You have encountered such a popup window in which I could display informations:
    1) Question text, sth like... "You hadn't saved Your changes. Do You wish to save them now?"
    2) list of changes (list contains 1-10 items), sth like ...
    - change 1
    - change 2
    - change 3 ...
    3) YES/NO button to decide if user wants to save or not
    At this moment I'm thinking of creating a Z-FModule... but of course I'd prefere to use standard Greetings. P.

    Hi,
    Try using the following function module that could possibly serve your purpose.
    data: ans(1) type C.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
       TITLEBAR                    = 'Confirm Data Loss'
      DIAGNOSE_OBJECT             = ' '
        TEXT_QUESTION               = 'Do you want to save your data?'
      TEXT_BUTTON_1               = 'Ja'(001)
      ICON_BUTTON_1               = ' '
      TEXT_BUTTON_2               = 'Nein'(002)
      ICON_BUTTON_2               = ' '
      DEFAULT_BUTTON              = '1'
      DISPLAY_CANCEL_BUTTON       = 'X'
      USERDEFINED_F1_HELP         = ' '
      START_COLUMN                = 25
      START_ROW                   = 6
      POPUP_TYPE                  =
      IV_QUICKINFO_BUTTON_1       = ' '
      IV_QUICKINFO_BUTTON_2       = ' '
    IMPORTING
       ANSWER                      = ans
    TABLES
      PARAMETER                   =
    EXCEPTIONS
       TEXT_NOT_FOUND              = 1
       OTHERS                      = 2.
    case ans.
    when '1'.
      PERFORM SAVE_DATA.
      LEAVE PROGRAM.
    WHEN '2'.
      LEAVE PROGRAM.
    WHEN 'A'.
        MESSAGE s000(su) WITH 'Action cancelled by the user'.
    ENDCASE.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Validation popup conflicting with confirmation popup

    I am using 11gR1.
    I have a form with three buttons on it CreateInsert, Next, Cancel.
    The next button fires model layer validation on a new record, the cancel button opens a confirmation popup and if the user clicks yes, navigates the away from the form. When a user clicks next AND the form does not pass the model layer entity validation, a validation error is raise in a validation popup. The problem comes when the user then decides to not fix the validation, but instead cancel out of the form via the cancel button AFTER they have already clicked next.
    When the user clicks the cancel button it raises the confirmation pop-up and whether the users clicks yes or no on the pop-up, the model layer validation still fires. I have immediate set to true on the cancel button to bypass validation, BUT if they user has already clicked next the validation still runs when they try to answer the pop-up. This results in the user being stuck in a never ending series of pop-ups because the confirmation pop-up can not close because the model layer validation keeps firing.
    I have a dialoglistener on the dialog and a method in the backing bean (backingBeanScope.backing_IAEdit.cancelConfirmDialog) but that code never fires. Anyone else run across this problem or have any ideas how to resolve it?
    Here is the code from the command buttons...
    <af:commandButton actionListener="#{bindings.CreateInsert.execute}" text="CreateInsert"    disabled="#{!bindings.CreateInsert.enabled}"
                                id="cb5"/>
    <af:commandButton actionListener="#{bindings.Next.execute}" text="Next" disabled="#{!bindings.Next.enabled}" partialSubmit="true"                    
                                id="cb2"/>
    <af:commandButton text="Cancel"  id="cb4" action="Cancel" immediate="true">
                    <af:showPopupBehavior popupId="p1"/>
    </af:commandButton>
    <af:popup id="p1">
                  <af:dialog id="CancelConfirmDialog" title="Confirm Cancel"  type="yesNo"
                                   dialogListener="#{backingBeanScope.backing_IAEdit.cancelConfirmDialog}">
                          <af:outputText value="Are you sure you would like to cancel?" id="CancelOutput"
                                         inlineStyle="font-weight:bold; font-size:small;"/>
                  </af:dialog>
    </af:popup>

    Thanks for the suggestion, but the code in the dialoglistener never fires.
    When the user clicks yes or no to dismiss the dialog box, the validation from the bc layer fires (even though immediate is set to true on the cancel button) and pops up an error box. When the error box opens, it opens in a modal way, the dialog box grays out and all you can do is dismiss the error box. When the user clicks ok to dismiss the error box, the dialog box is still open. Then when the user again clicks yes or no on the dialog box, it again fires validation and pops up the error box in a modal way. So now the user is stuck with these two pop ups and can never get rid of the dialog box.
    Just to clarify, this ONLY happens if the user FIRST clicked the next button which triggered the bc layer validation. If the user just clicks the cancel button, everything works as expected with the dialog box popping up, the user selects yes or no, the dialoglistener code is run and the user is navigated to another page. If the user just clicks the cancel button validation is never run as is expected by having immedate set to true.

  • How to Stop confirmation popup arising for datepicker control in IE

    Hello All,
    I m using a confirmation popup to notify user when they try to navigate away from the page with out saving the changes made. I executed it through the javascript and it even works properly for most of the items and buttons except Datepicker control. This issue is only with Internet Explorer and all others are fine.
    I use the following block of code to do the job
    +function isFormChanged()
    {+
    var rtnVal = false;
    var frm = document.wwv_flow;
    var ele = frm.elements;
    for ( i=0; i < ele.length; i+ )
    {+  
    +if ( isElementChanged( ele, i ) )
    {+
    rtnVal = true;
    break;
    +}+
    +}+
    return rtnVal;
    +}+
    +function isElementChanged( ele, i )
    {+
    var isEleChanged = false;
    +switch ( ele.type ) {+
    case "text" :
    +if ( ele[i].value != ele[i].defaultValue ) return true;+
    +if( ele[i].id.indexOf('Date')!=-1) return false;+
    break;
    case "textarea" :
    +if ( ele[i].value != ele[i].defaultValue ) return true;+
    break;
    case "radio" :
    val = "";
    +if ( ele[i].checked != ele[i].defaultChecked ) return true;+
    break;
    case "select-one" :
    +if      (ele[i].id>99 ) return false;+
    +for ( var x =0 ; x <ele[i].length; x++ )
    {+
    +if ( ele[i].options[ x ].selected+
    +!= ele[i].options[ x ].defaultSelected ) return true;+
    +}+
    break;
    case "select-multiple" :
    +if      (ele[i].id>99 ) return false;+
    +for ( var x =0 ; x <ele[i].length; x++ )
    {+
    +if ( ele[i].options[ x ].selected !=+
    +ele[i].options[ x ].defaultSelected ) return true;+
    +}+
    break;
    case "checkbox" :
    +if ( ele[i].checked != ele[i].defaultChecked ) return true;+
    default:
    return false;
    break;
    +}+
    +}+
    var g_saving = false;
    var IsThe2ndNavAway = false;
    var g_errmsg="The changes you made to the page were not saved.";
    +function WarnSave()
    {+
    var formChanged = isFormChanged();
    if (!g_saving && formChanged)
    +{+
    if(!IsThe2ndNavAway)
    +{+
    IsThe2ndNavAway=true;
    +var tOut = window.setTimeout(function () { IsThe2ndNavAway = false; }, 0);+
    return g_errmsg;
    +}+
    +}+
    +}+
    function doSave()
    +{+
    g_saving=true;
    doSubmit('SAVE');
    +}+
    the above lines on page Html header and the Html body attribute with onBeforeUnload="return WarnSave();"
    Can any one say why the confirmation popup is pushed of in IE for DatePicker Calendar alone and provide the work around if any..

    Are you still having this problem?  See this post how one AOL user solved it: http://forums.adobe.com/message/3024814#3024814

  • Confirmation popup in FPM OVP application controller?

    Is it possible to make use of confirmation boxes within the application controller of an FPM-OVP? In my application there is a logout button in the global toolbar. The event is captured within the application controller of the FPM-OVP application, thus in the method IF_FPM_OVP_CONF_EXIT~OVERRIDE_EVENT_OVP. Now, I would like to open a confirmation popup (Are you really, really, really sure? Yes/No/I will think about it) and to trigger the event only when it is answered with yes. In forms I have the possibility to make use of the extended interfaces and to implement the NEEDS_CONFIRMATION method. Is there something similar in the current context?
    Best regards,
    Thomas

    Hi Thomas,
    Try to use AFTER_NEEDS_CONFIRMATION method in application controller.
    Kind regards, Aliaksandr.

  • Html db - confirmation popup

    Hi everyone,
    I would like a "popup" which is posted when I press on Close button in my page and I've forgotten to record my data.
    Is this with Javascript which I can create this popup confirmation or HTML-DB offers something in this case ?
    Thank you very much. Bye.

    Do you mean a close button in HTMLDB or the browser window's close button? [HTMLDB cannot help much with the latter!]
    For buttons you created, just add a URL target as
    javascript:if(confirm("Are you sure?")) doSubmit('CLOSE');
    That will popup the box and if OK is clicked submit the page with REQUEST set to CLOSE

  • Superfluou​s confirm popup in UI editor?

    Hello NI,
    I have a XY graph with several annotations.
    If I open the uir file and double click on the graph (-> Edit Graph popup), click on the 'Annotations' button (-> Edit Annotations popup) and change Current Annotation say from 24 to 23 (to see its properties).
    Then I want to close everything (not changing anything): I click on the X button in the panel title of the 'Edit Annotations popup: a confirm popup shows up asking if I am sure to discard the changes. This popup is ok for the current annotation has changed. So I click Yes.
    By this all changes should have discarded, right?
    But now, if I click the X button in the panel of the Edit Graph popup the same confirm popup shows up again... In my opinion this should not happen ;-)
    (I know that I can leave the two popups faster by hitting ESC twice)
    Solved!
    Go to Solution.

    Yes, this is a bug, and it's been around since the beginning of CVI from what I can tell.
    It's actually two bugs: 1) you shouldn't see the prompt in the annotations dialog in the first place, if all that you change in that dialog is the current annotation (and the analogous control, in the graph's cursors dialog, or the strip chart's traces dialog), since changing the current annotation/cursor/trace does not change the state of the graph or chart. And 2), as you pointed out, you shouldn't see the prompt again when you exit the main dialog if you discarded your changes in the sub-dialog.
    Bug 477231.

  • Confirm delete in command button

    Hi All,
    My use case is to show a javascript confirm box after hitting the delete
    button(seems to be very basic use case). But whether I cancel it or press
    OK , the actionListener fires and corresponding row gets deleted.(Using JDev
    11g TP2).
    I found two relevant forum links on that issue but one can get no idea from those links.
    Those are
    Re: af:clientListener and javascript confirm() dialog
    RC client side events calling server side backing bean events
    Do we have a solution for the above described use case?
    Regards,
    Ghosh

    Hi Ghosh,
    Do you have delete operation binding actionListener in 'Delete' button? I think that is your possible problem.
    First at all, i supose that you have a af:popup with af:dialog to do the confirm box.
    I propose you to create a button with one af:clientListener to call a javascript function. This function have to show the af:popup. The af:dialog have a dialogListener, it allows you to detect when you click any button inside the dialog. Inside the backing function, it's possible to kwon the button type. If the button is OK, do the delete operatin binding.
    You have to know that If dialog is OkCancel type, this listener only is called if OK button is pressed (Cancel button doesn't call this function).
    I think that this structure is a solution for your use case.
    XerX

  • Javascript Confirm box dependent on results of query

    Hi
    I'm using Apex version 3.2.1 and I'm looking for a way to do the following, any help much appreciated:
    A javascript confirm box will appear when the user submits a page if the result of a query returns anything, the query would look something like this....
    SELECT * FROM LINKEDPROJECTS
    WHERE ENV_ID = :P18_ENV_ID
    AND COMP_ID = :P18_COMP_ID
    AND DATE_FROM <= to_date(:P18_DATE_TO, 'DD-MON-YY')
    AND DATE_TO >= to_date(:P18_DATE_FROM, 'DD-MON-YY')
    If it doesnt return any data the page will submit as normal, if it does return any data the confirm box will appear, and the message will also be driven by the result of a query.
    So the message would be something like....
    Project(s) +"Select NAME FROM PROJECTS WHERE ID IN (SELECT PROJ_ID FROM LINKEDPROJECTS WHERE ENV_ID = :P18_ENV_ID+
    +AND COMP_ID = :P18_COMP_ID+
    +AND DATE_FROM <= to_date(:P18_DATE_TO, 'DD-MON-YY')+
    +AND DATE_TO >= to_date(:P18_DATE_FROM, 'DD-MON-YY')"+ have this environment booked on the dates you selected.  Do you want to continue with the booking?
    Selecting yes submits the page, selecting no returns them to the page.

    In a nutshell (and some pseudo code):
    The button URL would look something like "javascript:beforeSubmit()" without quotes and where beforeSubmit is the name of your function.
    The function would look something like:
    function beforeSubmit() {
      var runQuery = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=RunTheQuery',1);
      var result = runQuery.get();
      if (result = 0) {
        if (!apex.confirm('Submit page?")
          return;
      doSubmit('SUBMIT');
    {code}
    The application process, called "RunTheQuery" in this example, is a PL/SQL block that runs the query and return the value using the htp.prn function.
    There are probably errors in the above as I just did this off the top of my head, and you will probably need to tweak it somewhat.  But hopefully you get the idea.
    Mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Problems Installing ColdFusion 9 (64 bit) on Windows 7 and IIS 7.5

    Problem:  Empty response for static Files including images, CSS and js files. The response code is 200 OK, but there is no actual response (it's empty). The ColdFusion Administration web site works correctly except it's not displaying any images, css

  • Silicone Macbook Case (Skin) - Where to buy?

    I have been searching everywhere for a soft case (like an iPod skin) for my Macbook. I have seen the decals, skintz, silicone keyboard/trackpad covers, skinit, bestskinsever, etc. I even had the new Speck clear hard case, but it was quite uncomfortab

  • SharePoint 2013 + ADFS 3.0 -- Office SSO

    Hello We have installed a SharePoint 2013 SP1 farm with multiple Web Applications (Portal and OneDrive). The users log in on an ADFS server 3.0 in the internal network and externally. This is working fine. Now we have 2 problems: The user has to sign

  • Inherit problems

    Dear reader, I have a problem. In my first class I have a collection and I need to inherit all it is value's to another class. My code: {color:#339966}public class Hattrick extends JPanel implements ActionListener { … Collection<Speler> spelers = new

  • Can I use facetime on my windows xp machine?

    How do can I use facetime on my windows xp machine.  I have friends that have ipads and want to know if I can communicate w/them via facetime.