get yes/no in client script confirmation prompt

anur
Kilo Contributor

Have a client script, which on a clearing a field value , will give below confirm dialog

find_real_file.png

Is there anyway to get "yes" and "no" instaed of "ok" and "cancel"

Thanks

6 REPLIES 6

Jon Hogland
Tera Guru

How do I view other replies?



If I've at all helped, please return the favor by clicking the thumb next to my post. Thanks!

Naveed_Hussain
Kilo Guru

Hi Anur,

 

The following code will help you to clear fields values by using confirm box / pop up box. When you'll click on 'Ok'. Your required fields values will clear. If you'll click 'Cancel' nothing will happen.

 

please mark my answer as accepted solution and helpful, if it works for you.

Thank you!

function onLoad() {
    //Type appropriate comment here, and begin script below
    var answer = confirm('Are you sure for clear field values');
    if (answer == true) {
        // I have selected dummy fields but you can select as per your needs
        g_form.setValue('number', '');
        g_form.setValue('short_description', '');
        g_form.setValue('description', '');

    } else {
        return false;
    }

}