469,271 Members | 1,627 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Do You Believe in Confirm?

I read in the book Javascript The Definitive Guide by David Flanagan
the following in reference to the use of alert, confirm, and prompt.

"Although these dialog methods are extremely simple and easy to use,
good design dictates that you use them sparingly, if at all. Dialog
boxes like these are not a common feature of the web paradigm, and
they have become much less common now that more capable web browsers
support scripting of the document content itself..."

Do you agree with this statment? If so, let us suppose you want to
confirm a delete operation. How do you go about doing this in a "web-
friendly" way.

Thanks,
Mike

May 11 '07 #1
13 1918
On Fri, 11 May 2007 08:20:25 -0700, MikeC wrote:
I read in the book Javascript The Definitive Guide by David Flanagan the
following in reference to the use of alert, confirm, and prompt.

"Although these dialog methods are extremely simple and easy to use,
good design dictates that you use them sparingly, if at all. Dialog
boxes like these are not a common feature of the web paradigm, and they
have become much less common now that more capable web browsers support
scripting of the document content itself..."

Do you agree with this statment? If so, let us suppose you want to
confirm a delete operation. How do you go about doing this in a "web-
friendly" way.
Yes. I've never used these features. Just a personal preference, not so
much a "you shouldn't do it" opinion.

There's virtually no difference in the code to write a confirmation form
and using the javascript dialog confirmation.

May 11 '07 #2
Daz
On May 11, 4:20 pm, MikeC <mcrav...@att.netwrote:
I read in the book Javascript The Definitive Guide by David Flanagan
the following in reference to the use of alert, confirm, and prompt.

"Although these dialog methods are extremely simple and easy to use,
good design dictates that you use them sparingly, if at all. Dialog
boxes like these are not a common feature of the web paradigm, and
they have become much less common now that more capable web browsers
support scripting of the document content itself..."

Do you agree with this statment? If so, let us suppose you want to
confirm a delete operation. How do you go about doing this in a "web-
friendly" way.

Thanks,
Mike
It depends on who you are and what you are trying to achieve.
Personally, I prefer the look and feel of a floating div, which you
can customise to your hearts content.

Obviously, the class for a customised div would take up considerably
more space that a simple:
var answer = confirm("Continue?");

If your script is seriously simple, or just a simple confirmation for
say, submitting a form, then I believe that the standard confirm
dialog will suffice. If you are writing a much larger, and more
complex script, like https://www.youos.com/ have done for example. I
think that the standard dialog box may look out of place, and a themed
confirmation box might be in order, that perhaps gives more than one
option to choose from.

We also need to take speed into account. Sure, almost everyone on the
internet these days has fast broadband, but there are still lots of
people out there on dialup connections. The more code we write, the
longer it takes them to load a page, and the more agitated they are
likely to become. We can't just shut out these people because it suits
us, can we? Perhaps we can, which brings me back to my original point.
It all depends on what you want to achieve.

Also, one thing to note: With the standard confirm dialog, the browser
is effectively frozen until the process is killed, or the confirmation
dialog has been answered. Sometimes this effect is desirable, other
times, it's not.

Hope I haven't said anything too dumb.

Best wishes.

Daz.

May 11 '07 #3
On May 11, 8:26 am, Ivan Marsh <anno...@you.nowwrote:
On Fri, 11 May 2007 08:20:25 -0700, MikeC wrote:
I read in the book Javascript The Definitive Guide by David Flanagan the
following in reference to the use of alert, confirm, and prompt.
"Although these dialog methods are extremely simple and easy to use,
good design dictates that you use them sparingly, if at all. Dialog
boxes like these are not a common feature of the web paradigm, and they
have become much less common now that more capable web browsers support
scripting of the document content itself..."
Do you agree with this statment? If so, let us suppose you want to
confirm a delete operation. How do you go about doing this in a "web-
friendly" way.

Yes. I've never used these features. Just a personal preference, not so
much a "you shouldn't do it" opinion.

There's virtually no difference in the code to write a confirmation form
and using the javascript dialog confirmation.
Ivan,

I think the objection to using confirm is two-fold. First, it pops up
a dialog which is a normal user interface in non-web applications. But
on the web, people don't like things popping up into separate windows.
The other possible objection - although I don't know this for sure -
is that these are modal controls, meaning that you can't do anything
else until you reply in some way.

How do you handle a confirmation form? Do you display it as another
frame? Thanks for your input.

May 11 '07 #4
On May 11, 8:33 am, Daz <cutenfu...@gmail.comwrote:
On May 11, 4:20 pm, MikeC <mcrav...@att.netwrote:
I read in the book Javascript The Definitive Guide by David Flanagan
the following in reference to the use of alert, confirm, and prompt.
"Although these dialog methods are extremely simple and easy to use,
good design dictates that you use them sparingly, if at all. Dialog
boxes like these are not a common feature of the web paradigm, and
they have become much less common now that more capable web browsers
support scripting of the document content itself..."
Do you agree with this statment? If so, let us suppose you want to
confirm a delete operation. How do you go about doing this in a "web-
friendly" way.
Thanks,
Mike

It depends on who you are and what you are trying to achieve.
Personally, I prefer the look and feel of a floating div, which you
can customise to your hearts content.

Obviously, the class for a customised div would take up considerably
more space that a simple:
var answer = confirm("Continue?");

If your script is seriously simple, or just a simple confirmation for
say, submitting a form, then I believe that the standard confirm
dialog will suffice. If you are writing a much larger, and more
complex script, likehttps://www.youos.com/have done for example. I
think that the standard dialog box may look out of place, and a themed
confirmation box might be in order, that perhaps gives more than one
option to choose from.

We also need to take speed into account. Sure, almost everyone on the
internet these days has fast broadband, but there are still lots of
people out there on dialup connections. The more code we write, the
longer it takes them to load a page, and the more agitated they are
likely to become. We can't just shut out these people because it suits
us, can we? Perhaps we can, which brings me back to my original point.
It all depends on what you want to achieve.

Also, one thing to note: With the standard confirm dialog, the browser
is effectively frozen until the process is killed, or the confirmation
dialog has been answered. Sometimes this effect is desirable, other
times, it's not.

Hope I haven't said anything too dumb.

Best wishes.

Daz.
Daz,

Yes I suspected the answer was not a simple aye or nay. I'm new to web
programming and don't exactly know what a floating div is. Since this
is a forum on Javascript and not on HTML, it might be inappropriate to
even ask what it is. I presume it must be a div section that is
capable of appearing anywhere within a document as well as
disappearing. If you would be so kind as to point me in the right
direction as to how to accomplish this, I would be very grateful.

May 11 '07 #5
Daz
On May 11, 4:36 pm, MikeC <mcrav...@att.netwrote:
On May 11, 8:26 am, Ivan Marsh <anno...@you.nowwrote:
On Fri, 11 May 2007 08:20:25 -0700, MikeC wrote:
I read in the book Javascript The Definitive Guide by David Flanagan the
following in reference to the use of alert, confirm, and prompt.
"Although these dialog methods are extremely simple and easy to use,
good design dictates that you use them sparingly, if at all. Dialog
boxes like these are not a common feature of the web paradigm, and they
have become much less common now that more capable web browsers support
scripting of the document content itself..."
Do you agree with this statment? If so, let us suppose you want to
confirm a delete operation. How do you go about doing this in a "web-
friendly" way.
Yes. I've never used these features. Just a personal preference, not so
much a "you shouldn't do it" opinion.
There's virtually no difference in the code to write a confirmation form
and using the javascript dialog confirmation.

Ivan,

I think the objection to using confirm is two-fold. First, it pops up
a dialog which is a normal user interface in non-web applications. But
on the web, people don't like things popping up into separate windows.
The other possible objection - although I don't know this for sure -
is that these are modal controls, meaning that you can't do anything
else until you reply in some way.

How do you handle a confirmation form? Do you display it as another
frame? Thanks for your input.
The method I've seen a lot of is called a "lightbox" (see
http://www.huddletogether.com/projects/lightbox/ for information and a
demo). It's basically a floating div, that is centered on the page,
when it is displayed, it places another full page div underneath it,
which covers the page contents, which can prevent the user from
clicking on any links on the page, or highlighting text etc, until the
confirmation has been confirmed. The main trouble with such dialogs
are that it's not always easy to make it work across all platforms.
Although I believe that they have it sussed pretty well, as browsers
change, so will the lightbox. With a standard confirmation dialog, you
know it's going to work straight out of the box with all browsers that
have JavaScript enabled.

Also, with the lightbox, the user can still hit refresh, and possibly
lose anything that was being worked on (like a form they were filling
out). I know that there are methods to prevent page refreshes, but I
think that these hacks only work for the later versions of IE, and
Firefox, however, I am not certain.

Remember: KISS :)

Daz

May 11 '07 #6
Daz
On May 11, 4:45 pm, MikeC <mcrav...@att.netwrote:
On May 11, 8:33 am, Daz <cutenfu...@gmail.comwrote:
On May 11, 4:20 pm, MikeC <mcrav...@att.netwrote:
I read in the book Javascript The Definitive Guide by David Flanagan
the following in reference to the use of alert, confirm, and prompt.
"Although these dialog methods are extremely simple and easy to use,
good design dictates that you use them sparingly, if at all. Dialog
boxes like these are not a common feature of the web paradigm, and
they have become much less common now that more capable web browsers
support scripting of the document content itself..."
Do you agree with this statment? If so, let us suppose you want to
confirm a delete operation. How do you go about doing this in a "web-
friendly" way.
Thanks,
Mike
It depends on who you are and what you are trying to achieve.
Personally, I prefer the look and feel of a floating div, which you
can customise to your hearts content.
Obviously, the class for a customised div would take up considerably
more space that a simple:
var answer = confirm("Continue?");
If your script is seriously simple, or just a simple confirmation for
say, submitting a form, then I believe that the standard confirm
dialog will suffice. If you are writing a much larger, and more
complex script, likehttps://www.youos.com/havedone for example. I
think that the standard dialog box may look out of place, and a themed
confirmation box might be in order, that perhaps gives more than one
option to choose from.
We also need to take speed into account. Sure, almost everyone on the
internet these days has fast broadband, but there are still lots of
people out there on dialup connections. The more code we write, the
longer it takes them to load a page, and the more agitated they are
likely to become. We can't just shut out these people because it suits
us, can we? Perhaps we can, which brings me back to my original point.
It all depends on what you want to achieve.
Also, one thing to note: With the standard confirm dialog, the browser
is effectively frozen until the process is killed, or the confirmation
dialog has been answered. Sometimes this effect is desirable, other
times, it's not.
Hope I haven't said anything too dumb.
Best wishes.
Daz.

Daz,

Yes I suspected the answer was not a simple aye or nay. I'm new to web
programming and don't exactly know what a floating div is. Since this
is a forum on Javascript and not on HTML, it might be inappropriate to
even ask what it is. I presume it must be a div section that is
capable of appearing anywhere within a document as well as
disappearing.
A floating div is exactly what you might think. It's a div element,
that floats. Hehe. When you float a div, it's effectively standalone,
and can be postitioned according to the boundaries of it's parent
element, or the window element, in fact, any element you want. When
you float a div, it will be positioned using absolute positioning. It
won't automatically fit to the size of the parent element, so the
boundaries of the floating div can overlap the boundaries of any other
elements on the page.

On top of all of this, you need to specify the z-index of the element.
Z-index is the order of the layers. The higher the number of the
index, the closer to the top it will be.

An element with a z-index of say, 100, will appear on top of any
elements with a lower z-index. If you have anymore questions, feel
free to ask, but remember that Google is your best friend.

To anyone else, if I am wrong in any way, please correct me. I haven't
been programming in JavaScript for very long, but I think I understand
many of the concepts.
If you would be so kind as to point me in the right
direction as to how to accomplish this, I would be very grateful.
Done! Please see above :)

May 11 '07 #7
On May 11, 8:51 am, Daz <cutenfu...@gmail.comwrote:
On May 11, 4:36 pm, MikeC <mcrav...@att.netwrote:


On May 11, 8:26 am, Ivan Marsh <anno...@you.nowwrote:
On Fri, 11 May 2007 08:20:25 -0700, MikeC wrote:
I read in the book Javascript The Definitive Guide by David Flanagan the
following in reference to the use of alert, confirm, and prompt.
"Although these dialog methods are extremely simple and easy to use,
good design dictates that you use them sparingly, if at all. Dialog
boxes like these are not a common feature of the web paradigm, and they
have become much less common now that more capable web browsers support
scripting of the document content itself..."
Do you agree with this statment? If so, let us suppose you want to
confirm a delete operation. How do you go about doing this in a "web-
friendly" way.
Yes. I've never used these features. Just a personal preference, not so
much a "you shouldn't do it" opinion.
There's virtually no difference in the code to write a confirmation form
and using the javascript dialog confirmation.
Ivan,
I think the objection to using confirm is two-fold. First, it pops up
a dialog which is a normal user interface in non-web applications. But
on the web, people don't like things popping up into separate windows.
The other possible objection - although I don't know this for sure -
is that these are modal controls, meaning that you can't do anything
else until you reply in some way.
How do you handle a confirmation form? Do you display it as another
frame? Thanks for your input.

The method I've seen a lot of is called a "lightbox" (seehttp://www.huddletogether.com/projects/lightbox/for information and a
demo). It's basically a floating div, that is centered on the page,
when it is displayed, it places another full page div underneath it,
which covers the page contents, which can prevent the user from
clicking on any links on the page, or highlighting text etc, until the
confirmation has been confirmed. The main trouble with such dialogs
are that it's not always easy to make it work across all platforms.
Although I believe that they have it sussed pretty well, as browsers
change, so will the lightbox. With a standard confirmation dialog, you
know it's going to work straight out of the box with all browsers that
have JavaScript enabled.

Also, with the lightbox, the user can still hit refresh, and possibly
lose anything that was being worked on (like a form they were filling
out). I know that there are methods to prevent page refreshes, but I
think that these hacks only work for the later versions of IE, and
Firefox, however, I am not certain.

Remember: KISS :)

Daz- Hide quoted text -

- Show quoted text -
Daz,

This looks like a great alternative. Thanks a bunch.

May 11 '07 #8
MikeC <mc******@att.netwrote in news:1178896825.556152.327040
@o5g2000hsb.googlegroups.com:

Do you agree with this statment? If so, let us suppose you want to
confirm a delete operation. How do you go about doing this in a "web-
friendly" way.
Personally, I think there is a place for it. As you mention, all my
delete/"serious" background operations depend on a javascript confirm by
the user.

I feel its appropriate, easy, and fits in with web applications - its a lot
like a 'system' dialog, and hence i use it on 'system'-type operations
(deleting files, granting specialized access etc).

I try to avoid hard-and-fast rules of any sort for programming, there are
so many variations.

Why replicate the function of a javscript confirm in a <div>? It's still a
"pop-up", not to mention you now have extra HTML to download. Why not take
the simple, proven, lightweight option? Why embrace certain parts of
javascript and decry others?
May 11 '07 #9
Daz
On May 11, 5:10 pm, Good Man <h...@letsgo.comwrote:
MikeC <mcrav...@att.netwrote in news:1178896825.556152.327040
@o5g2000hsb.googlegroups.com:

Why replicate the function of a javscript confirm in a <div>? It's still a
"pop-up", not to mention you now have extra HTML to download. Why not take
the simple, proven, lightweight option? Why embrace certain parts of
javascript and decry others?
Simple:

Customisability (if that's even a word)
To change the behavior of something
Aesthetics
An attempt to enhance user experience and usability (Although this
quite often fails)

I think on the Web today, there are many Web sites that are very
plain. For people like us, who develop, these kinds of sites are
fantastic. They display the information we require in a clear and
concise way. By keeping it plain and simple, means that we developers
don't have to curse so much.

On the other hand, to non-developers, Web sites are very much like
food. You eat with your eyes. If you like what you see, and enjoy
using it, it's something you won't forget, and your visitors will most
likely return, and possibly bring more users with them. By giving
users something they've never seen or experienced before, or just by
trying to be unique, you are going to get a lot of visitors.

My example earlier, was www.youos.com . I suggest you check it out.
It's a very good example of that can be achieved with JavaScript. Do
we have any use for it? No not really, but for the average Joe, I am
pretty sure it's priceless. To my knowledge, YouOS has been around for
some years, and is still undergoing development. To me this suggests 1
of two things. The developers are fixated with the idea, and just
can't stop scripting it, or it's quite popular among normal users. I
think it's the latter. :)

What we "really" need, is a customisable standard confirmation dialog.
This way we can have something other than "yes" or "no". Will it ever
become a standard? Ha! I'll answer that with another question. Do
Microsoft know the meaning of the word "free" or "open-source"?

The Web is evolving fast, and their are many people who are fixated on
keeping everything simple, and not taking advantage of the new
functionality and techniques that are available. Whilst I don't
disagree with this way of looking at it one bit (we all know that
simplicity provails), my "preference", is to be creative, and move
with the times.
May 11 '07 #10
Lee
Good Man said:
>Why embrace certain parts of javascript and decry others?
Is that a serious question?
--

May 11 '07 #11
MikeC wrote:
Let us suppose you want to confirm a delete operation.
How do you go about doing this in a "web-friendly" way.
Another problem with the confirm approach is that your user's options
are limited to "OK" and "Cancel". In the case of deleting something, a
more user-friendly confirmation "dialog" would have perhaps "Yes" and
"No" options: (Are you sure you wish to delete this? [Yes] [No]).

Or consider when you are editing something and you go to close it. Most
apps give you three options, when it asks if you want to save changes.
Yes, No, and Cancel.

None of these are possible with a JavaScript confirm() dialog. Using a
floating div/"lightbox" approach as mentioned in this thread is a great
way to achieve this.
May 11 '07 #12
On Fri, 11 May 2007 10:40:14 -0700, Lee wrote:
Good Man said:
>>Why embrace certain parts of javascript and decry others?

Is that a serious question?
I think this just became a GOTO discussion.

May 11 '07 #13
Daz <cu********@gmail.comwrote in
news:11**********************@y80g2000hsf.googlegr oups.com:
On May 11, 5:10 pm, Good Man <h...@letsgo.comwrote:
>MikeC <mcrav...@att.netwrote in news:1178896825.556152.327040
@o5g2000hsb.googlegroups.com:

Why replicate the function of a javscript confirm in a <div>? It's
still a "pop-up", not to mention you now have extra HTML to download.
Why not take the simple, proven, lightweight option? Why embrace
certain parts of javascript and decry others?

Simple:

Customisability (if that's even a word)
To change the behavior of something
Aesthetics
An attempt to enhance user experience and usability (Although this
quite often fails)

What we "really" need, is a customisable standard confirmation dialog.
This way we can have something other than "yes" or "no".
good post, and yes, i have wished for such a thing often.
May 11 '07 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Logger | last post: by
1 post views Thread by freshRecruit | last post: by
1 post views Thread by chris | last post: by
4 posts views Thread by tfsmag | last post: by
8 posts views Thread by rn5a | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.