473,789 Members | 2,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Confirmation message box on a link click?

Hi,

I'm working on a PHP FTP client, but my testers have complained the delete file
link is too easy to hit by mistake. Would it be possible/plausible to write a
bit of javascript that pops up a confirmation when they click the link, that
goes to a certain page if they click yes and does nothing if they click no?

I have no idea if this is tough or not. Any help with this would be greatly
appreciated.

Regards,
Craig
Jul 20 '05 #1
3 24185
On Wed, 18 Feb 2004 20:29:32 +0000, Craig <cr*******@hotm ail.com> wrote:
I'm working on a PHP FTP client, but my testers have complained the
delete file link is too easy to hit by mistake. Would it be
possible/plausible to write a bit of javascript that pops up a
confirmation when they click the link, that goes to a certain page if
they click yes and does nothing if they click no?


This is fairly simple to do, but very unreliable: if JavaScript is
disabled, there will be no confirmation option. The best thing to do would
be to list on a new page all of the files and directories that will be
deleted (or a summary of them), then get the user to confirm the deletion
that way.

If you still want to proceed with a JavaScript method:

<a href="delete.ph p"
onclick="return confirm('Are you sure?');">Delet e</a>

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2
Michael Winter wrote:
On Wed, 18 Feb 2004 20:29:32 +0000, Craig <cr*******@hotm ail.com> wrote:
I'm working on a PHP FTP client, but my testers have complained the
delete file link is too easy to hit by mistake. Would it be
possible/plausible to write a bit of javascript that pops up a
confirmation when they click the link, that goes to a certain page if
they click yes and does nothing if they click no?

This is fairly simple to do, but very unreliable: if JavaScript is
disabled, there will be no confirmation option. The best thing to do
would be to list on a new page all of the files and directories that
will be deleted (or a summary of them), then get the user to confirm the
deletion that way.

If you still want to proceed with a JavaScript method:

<a href="delete.ph p"
onclick="return confirm('Are you sure?');">Delet e</a>

Mike


Yea I had a think and decided I do wanna go with the javascript. At the end of
the day if a user deletes a file by mistake when the alert doesnt popup its
still their own fault. The link is very clealy labelled, after all.

So that works a treat. Thanks!
Jul 20 '05 #3
<html><head><ti tle>href confirm</title>
<script type="text/javascript">
function linkRef(yurl ){
var linkref = yurl;
if(confirm("do you really want to go here?")){
window.location .href=linkref;
}
}
</script>
</head>
<body>
<a href="#" onClick="linkRe f('http://www.yahoo.com' )">Yahoo.com </a>
</body>
</html>
Jul 20 '05 #4

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

Similar topics

9
6281
by: ScooterMX | last post by:
I have a <a href="javascript:top.window.close()"><img src="exit.gif"></a> tag on my page that closes itself when you click on it. What I NEED is for it to put up a confirmation message that simply asks "This will end your session and close the window", then offers a cancel or ok button. Clicking on ok closes both the page it was on, and the confirmation window. Can someone suggest a simple way to do this?
6
3710
by: Nedu N | last post by:
Hi, I want to have confirmation(Yes/No) on a button of the webform in which there are many validation controls. I want all the validation controls to be triggered first and then Yes/No confirmation message. By adding just an confirm attribute for 'onclick' event of the button doesn't work with validation controls. Is there any short way to go around this. Thanks Nedu
6
3418
by: Dave | last post by:
Hello. I want to prompt user for some action with Yes/No message, I know some tricks in JavaScript, but I need to handle the user answer at server side. Exactly I want to prompt user for confirmation on delete action of some data in my application. How can I do this?
3
1565
by: Imran Aziz | last post by:
Hello All, I have a delete link on my page, which when clicks calls the URL for deletion, in ASP we use to create a java script confirm box to confirm delete, how can that be done in ASP? Say if I use an ASP link control , or if I use a html anchor link. This is how I am trying to do it <script language="javascript"> function ConfirmDelete(nChannelID)
11
3130
by: Prince of Code | last post by:
Hey There, I have been to this group for a couple of days. I am really impressed by the way people respond. I get answers for all my doubts and that too more info. So I am putting across a doubt that i hav During registering in some website we are forced to give our valid email id. Also they send a mail and a url is given , when we click that our registration is confirmed. Why does they do so. And programatically what happens.
1
2570
by: almarc | last post by:
Problem : Stop an "Unonlaod" when then confirmation is false. Is a really good script but i have just one problem. The problem that i have is when i click on a link. The scipt ask "Do you want to save DATA". When you click "Yes" and the name form is empty. The script tell you a message, but i go to another page. ALL I WANT IS TO BLOCK IT, AND STAY IN THE SAME PAGE WITHOUT RELOADING. LIKE WHEN YOU CLICK SUBMIT. Can some one help me ? Is a...
2
2923
by: .Net Sports | last post by:
I'm using CDO mail in my asp scripts, and I need to find a script that whereas a user signs up for your website and when he hits submit, an email goes to his email box with a confirmation link for him to click so to ensure he has a valid email address. Does anyone know of a package or series of scripts that works with this? Thanks netsports
2
7718
by: bay_dar | last post by:
Hi, I have an internal ASP.NET application that I'm are using to send e-mails out based on a single milepost or milepost range entered. I'm trying to do two things when a user clicks on the submit button to submit a form that contains one or two Mileposts: 1) If a Milepost range larger than 5 miles is entered, I would like to pop up a confirmation box to confirm the range.
2
2241
by: kaka | last post by:
I am developping a sns site. I was wondering if i send user's email addresses as a part of confirmation link so that when a user receives the confirmation email, he can just click on the link to login to our site without punching in the password.
0
9511
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
10199
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
10139
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
9983
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
9020
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
7529
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
6769
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
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.