Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
| Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 19th, 2005, 02:18 PM
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Javascript Confirm dialog difficulty

Ok, this one is baffling me.

We're writing a web app, and every time a user clicks any control on the page, we are disabling all the other controls via Javascript so as to keep people from double-clicking. However, on one page, one button must do an additional task: display a confirmation dialog and then disable all the controls on the form (although any order would work). For example:

onClick = "if(Confirm('CommitDeleteButton','','Are you sure you want to delete this record?','','')) { DisableForm(); return true; } else { return false; }"

The form gets disabled but never posts, which means that return true is never reached. Does this happen because the control is disabled? The code must stay in the onclick event and cannot employ any other scripts elsewhere. Any ideas?
  #2 (permalink)  
Old May 20th, 2005, 03:34 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Is this code in the onclick of the submit button? If so the return value won't do anything, to be effective it must be in the onsubmit handler.
Why must all code be inline in the handler rather than calling a function, it's much harder to debug and maintain?

--

Joe (Microsoft MVP - XML)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript confirm box with just an 'OK' button crmpicco Javascript How-To 28 March 12th, 2014 06:44 AM
Difficulty writing javascript to access dom ldoyle Javascript How-To 2 February 23rd, 2007 11:25 AM
JavaScript Confirm Box ricespn Classic ASP Basics 1 January 20th, 2007 12:48 AM
"confirm" dialog before processing dropdown event glandgraf@gocfi.com .NET Framework 2.0 1 March 21st, 2005 11:58 AM
need Confirm() with Yes/No buttons in JavaScript ehelpcornet ASP.NET 1.0 and 1.1 Basics 1 June 3rd, 2004 07:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.