Capturing the 'No' Answer in a Dialog Box

Capturing the 'No' Answer in a Dialog Box

  
Hi guys!

I would like to ask how to perform actions if the user answers 'No' in a Confirmation dialog box?

Thanks!

Ju-chan
To be able to use the result of the confirmation dialog, you would need to use something like

if (confirm('Are you sure you want to save this thing into the database?')) {
    // Save it!
} else {
    //Do something
}

Hi Ju-chan,

If you want to call a different action on the page, do something like this (based on João original suggestion):

create 2 hidden buttons in service studio with the logic for each case:

<button id="GeneratedSaveButtonId" style="display:none" onclick="..." />
<button id="GeneratedCancelButtonId" style="display:none" onclick="..." />

create a visible button that calls a javascript function onclick:

<button type="button" onclick="DoConfirm(); return false;" />  

function DoConfirm() {
  if (confirm('Are you sure you want to save this thing into the database?')) {

    $('#GeneratedSaveButtonId').click();
  } else {
    $('#GeneratedCancelButtonId').click();
  }
}

Regards,
HD
Hi everyone!

Thank you for the answers! I did Hélio Dolores' answer and it worked! Thanks a lot :)