Yes / No vs OK / Cancel

Posted on 2007-11-19
Last Modified: 2011-09-20
lbTempTest.Attributes.Add("onClick", "return confirm('Do you want to add another Debt Item?');");

This part:

return confirm('Do you want to add another Debt Item?');

Do I have different options for this?

Can I do "Yes / No" buttons instead of "OK / Caoncel"?

How does this work?
Question by:knowlton

Assisted Solution

DavidTMoore earned 100 total points
ID: 20316708
Javascript confirms are browser specific and cannot be changed.  You will need to build a custom control to achieve this.

LVL 16

Accepted Solution

gnoon earned 400 total points
ID: 20317115
>Can I do "Yes / No" buttons instead of "OK / Caoncel"?
Yes, you can.

>How does this work?
You change to this

lbTempTest.Attributes.Add("onClick", "return (makeMsgBox('Confirm','Do you want to add another Debt Item?',2,4,0,0)==6);");

Then define the makeMsgBox function on the page
<script language=vbscript>


'Make user dialog appear

'@param title title string

'@param mess message string

'@param icon 

'	0 - no icon

'	1 - red cross

'	2 - question

'	3 - warning

'	4 - information

'@param buts

'	0 - [OK]

'	1 - [OK] [Cancel]

'	2 - [Abort] [Retry] [Cancel]

'	3 - [Yes] [No] [Cancel]

'	4 - [Yes] [No]

'	5 - [Retry] [Cancel]

'@param defbut

'	0 - 1st as default

'	1 - 2nd as default

'	2 - 3rd as default

'@param mods

'	0 - Application Modal

'	1 - System Modal

Function makeMsgBox(title,mess,icon,buts,defbut,mods)

    butVal = buts + (icon*16) + (defbut*256) + (mods*4096)

    makeMsgBox = MsgBox(mess,butVal,title)

End Function



Open in new window


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Multiple file Upload 2 40
Achieve json result 2 65
Cannot upload files above 1mb IIS7 11 39 dynamic formulas in runtime 11 62
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now