Add JavaScript pop up in custom button to DetailView

Hello all

I am trying to add a new custom button to the AOS_Quotes Detail View. So far so good… I have followed the instructions of the Developer Guide and got to add the button and perform the action I needed.

What I would like to add is a “pop-up” window to show a “Caution” message to the user, so when the user presses the button a new pop-up window would appear saying “Be careful to make sure you want to do this”, and if he clicks OK then perform the action, Cancel-> then nothing happens and we are back to the Detail View.

How can I do it??

The way I added the button in the detailviewdefs.php file is

  4=>
             array (
                 'customCode' => '<input type="submit" class="button" onClick="this.form.action.value=\'sendQuote\';" value="{$MOD.LBL_SEND_DISTRIBUTOR}">',
                 'sugar_html' =>
                     array (
                         'type' => 'submit',
                         'value' => '{$MOD.LBL_SEND_DISTRIBUTOR}',
                         'htmlOptions' =>
                             array (
                                 'class' => 'button',
                                 'id' => 'send_distributor_button',
                                 'title' => '{$MOD.LBL_SEND_DISTRIBUTOR}',
                                 'onclick' => 'this.form.action.value=\'sendQuote\';',
                                 'name' => 'Send Quote',
                             ),
                     ),
             ),