Do You Believe in Confirm?

M

MikeC

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
 
I

Ivan Marsh

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.
 
D

Daz

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.
 
M

MikeC

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.
 
M

MikeC

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.
 
D

Daz

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
 
D

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 :)
 
M

MikeC

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.
 
D

Daz

@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.
 
J

Joe Attardi

MikeC said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,823
Latest member
Nadia88

Latest Threads

Top