473,670 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rookie question on "confirm" dialog

I need a dialog box with Yes, No, and Cancel buttons that pops up when a
link is clicked.

I'm using asp on the server side, and basically, if the user clicks yes, I
want to go to a certain page and pass a certain variable value. For example:

href="my_page.a sp?answer=yes"

If they click no, I would call :

href="my_page.a sp?answer=no"

If they select cancel, I return false to cancel the default link action and
nothing happens.

What is the easiest and cleanest way to accomplish this?

TIA!

Calan
Jul 23 '05 #1
7 2022
calan wrote:
I need a dialog box with Yes, No, and Cancel buttons that pops up when a
link is clicked.

I'm using asp on the server side, and basically, if the user clicks yes, I
want to go to a certain page and pass a certain variable value. For example:

href="my_page.a sp?answer=yes"

If they click no, I would call :

href="my_page.a sp?answer=no"

If they select cancel, I return false to cancel the default link action and
nothing happens.

What is the easiest and cleanest way to accomplish this?


As you cannot change the default dialogs and in time of popupblockers
and no real modal dialogs in gecko based browsers, I use my own <div>
based dialog with the elements I need. I therefore created a method
which will show up to three buttons with each caption passed to the
dialog. Something like:

function MsgBox(title,te xt,btn1,btn2,bt n3) {
this.title = title;
this.text = text;
this.btn1 = btn1;
this.btn2 = btn2;
this.btn3 = btn3;

if (!btn1)
btn1 = "OK";

// some more code to fill the dialog and show the div.
}

Your HTML might look like this (with some additional CSS)

<div id="msgBox">
<div id="msgBoxTitle "></div>
<div id="msgBoxText" ></div>

<div id="msgBoxBtnCo ntainer">
<div id="msgBoxBtn1 " onclick="MsgBox .notify(1)"></div>
<div id="msgBoxBtn2 " onclick="MsgBox .notify(2)"></div>
<div id="msgBoxBtn3 " onclick="MsgBox .notify(3)"></div>
</div>
</div>

When the user presses one of the buttons, another method gets called
(MsgBox.notify) which stores some properties like the button pressed,
it's caption etc. That method will call another predefined method that
was defined as recall function before calling the dialog:

MsgBox.notify = function(btnID) {
// code to hide the div dialog and set some props

this.returnValu e = btnID;
this.returnStri ng = this["btn" + btnID];
if (typeof this.returnMeth od == "function")
this.returnMeth od(this);
this.returnMeth od = null;
}

Call it like this:

function foo() {
MsgBox.returnMe thod = userAnswer;
MsgBox("Logout" ,"Do you want to save your
settings?","Yes ","No","Cancel" );
}

function userAnswer(msg) {
if (msg.returnStri ng == "Yes")
// do something on yes
else if (msg.returnStri ng == "No")
// do something on no
else
// cancel
}

HTH
Daniel
Jul 23 '05 #2
On Tue, 07 Dec 2004 02:57:11 GMT, "calan" <no**@nospam.co m> wrote:
I need a dialog box with Yes, No, and Cancel buttons that pops up when a
link is clicked.

I'm using asp on the server side, and basically, if the user clicks yes, I
want to go to a certain page and pass a certain variable value. For example:

href="my_page. asp?answer=yes"

If they click no, I would call :

href="my_page. asp?answer=no"

If they select cancel, I return false to cancel the default link action and
nothing happens.

What is the easiest and cleanest way to accomplish this?


I don't understand the reason for this. Could you explain why you want
to do this? If someone clicks on a link, why don't you assume that
they want to follow it? Why place an additional impediment in their
path? I also don't understand the difference between No and Cancel.
Aren't they the same?

I'm asking the question since I just started working with web pages
and I'm wondering if I may be missing out on a special way of
navigating.

--
Erik
Jul 23 '05 #3
The link is to an order number in a database; clicking the link allows them
to edit the order. What I'm trying to do is, when the link is clicked, they
have the option of editing the existing order, or bumping it a revision
number and then editing.

"Do you wish to edit the existing order?"
yes = go to edit page; pass a variable that tells my asp to not do
anything special

no = go to edit page; pass avariable that tells asp to copy all order
data to new records and make it current, then edit that.

cancel = do nothing; stay on the list of orders page.

"er***@nospam.w anted.here" <e3****@spamex. com> wrote in message
news:0k******** *************** *********@4ax.c om...
On Tue, 07 Dec 2004 02:57:11 GMT, "calan" <no**@nospam.co m> wrote:
I need a dialog box with Yes, No, and Cancel buttons that pops up when a
link is clicked.

I'm using asp on the server side, and basically, if the user clicks yes, Iwant to go to a certain page and pass a certain variable value. For example:
href="my_page. asp?answer=yes"

If they click no, I would call :

href="my_page. asp?answer=no"

If they select cancel, I return false to cancel the default link action andnothing happens.

What is the easiest and cleanest way to accomplish this?


I don't understand the reason for this. Could you explain why you want
to do this? If someone clicks on a link, why don't you assume that
they want to follow it? Why place an additional impediment in their
path? I also don't understand the difference between No and Cancel.
Aren't they the same?

I'm asking the question since I just started working with web pages
and I'm wondering if I may be missing out on a special way of
navigating.

--
Erik

Jul 23 '05 #4
"calan" <no**@nospam.co m> wrote:
"Do you wish to edit the existing order?"
yes = go to edit page; pass a variable that tells my asp to not do
anything special

no = go to edit page; pass avariable that tells asp to copy all order
data to new records and make it current, then edit that.

cancel = do nothing; stay on the list of orders page.


The meaning of "no" does not match the question. Make it two links,
"edit" and "copy".

Bye,
Martin

PS: Please don't top quote.
Jul 23 '05 #5
Martin Bialasinski wrote:
"calan" <no**@nospam.co m> wrote: [...] The meaning of "no" does not match the question. Make it two links,
"edit" and "copy".


What, and save the user a click? Good grief, what are buttons for if
not for clickin'!! ;-)
--
Rob
Jul 23 '05 #6
Well thanks for the helpful input into my original question... If I could
use two links I would :-)
Jul 23 '05 #7
"calan" <no**@nospam.co m> wrote:
Well thanks for the helpful input into my original question... If I
could use two links I would :-)


The are no dialog boxes with three options in javascript.

If you want it cross-browser, a simulated dialog box with a high
z-index div will work, as already suggested.
To make it modal, maybe a transparent backpane with onclick captured
and cancled could be used. Don't know if this works.

Or you can make it old-style:
Intermediate page with "Edit this order", "Copy order" and
"Back" links.
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6178
by: Alan | last post by:
I post this message here because I have post in js.group before, but onone answer, thus i guess this is ASP issue. <A HREF="http://SomeWebSite" OnClick="return confirm('Are you sure?')">Click me</A> or <A HREF="http://SomeWebSite" OnClick="return confirm('Are you
4
3112
by: Rui Santos | last post by:
Folks, How can change the text labels in the "confirm" buttons? Instead OK and Cancel, i want "Yes" and "No". Regards, Rui
4
46452
by: LP | last post by:
Hi, My webservice is currently deployed on WIndows 2000 server and runs pretty fine. I am trying to run my webservice on a Windows 2003 server. My webservice tries to write to a eventlog. The code is as follows: System.Diagnostics.EventLog Log = new System.Diagnostics.EventLog( EventLogName ); Log.Source = EventLogName; Log.WriteEntry( "PCHistory Service Application started up successfully.",
0
1672
by: JT | last post by:
In looking around on the internet to find out how to use a "messagebox"-like window on a webform, I have come across a few examples of how to do so from the "onclick" event of a button. In my situation I am using a third party treeview control that has a context menu on each node. If a user clicks on one of the context menu options, I would like for a "confirm" box to pop up and make sure that's what they wanted to do. I would be very...
6
7204
by: Alex Maghen | last post by:
Let's say I have a web forms button which performs a Delete or something. I'd like a click on the button to pop an "Are you Sure" dialog on the client side and then only execute the button's OnClick operation on the server side if the user had clicked Ok (as opposed to Cancel) on the pop-up dialog. I know I can do this all myself with JavaScript, but I was just wondering if any such functionality is already built-in in ASP.NET 2.0 so that...
5
5414
by: strikefiend | last post by:
Ok, I'm somewhat new to .NET C# language and am having a bit of trouble. I'm trying to run the javascript confirm() method from my ascx page but I'm currently using C# as the main language of the page so it's not recognizing the confirm method. On previous attempts, I tried to do this straight from the radiobutton control that I want it linked to, but I have another method that I need to run after it if the user did click ok on the confirm...
1
5766
by: kang jia | last post by:
hi now i would like user to delete what they don;t want to buy after they already put it in shopping cart. i would like to have a pop up box to alert users that they are going to delete what they put in shopping cart. if they click "yes" then it will proceed to delete the item. if they click "no" , then it will not execute delete action. this is to prevent user to accidently delete the item. i am not sure how should i do it. can anyone...
7
27175
by: kang jia | last post by:
hi currently, i would like to do a "confirm delete dialog box" , before user really decide to delete. so when user click delete, dialog box will pop up , saying "confirm delete ?" if yes, then go to delete page, otherwise still remain in the same page. i don;t know how to do it, is there any simple method to solve this? any one can help? thanks
2
2171
Claus Mygind
by: Claus Mygind | last post by:
Is there a newer version of javaScript that will allow other text on the confirm dialogue box in place of "Ok" and "Cancel" Specifically for FireFox. I know that I can use visual basic for internet explorer, but that cannot be used in FireFox.
0
8469
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8814
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7419
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6213
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5684
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.