Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
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
Old April 25th, 2008, 11:18 AM
Authorized User
Join Date: Nov 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default onclick="javascript: return false" on vista

Hi Folks:

I have tried the following validation code before a submit takes place:

<asp:Button .... onclick="JavaScript: return validation();"

it used to work fine, but when I tried to test my page on ie in windows vista, it simply executes the submit whithout evaluating the return of the function (true or false).

My question is: do i have to do another type of validation?


Old May 25th, 2008, 06:09 PM
Friend of Wrox
Join Date: Sep 2005
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts

Hi Gabriel,

Are you sure your syntax is correct? For an <asp:Button> you need to use the OnClientClick attribute as OnClick is the back end event handler. Also, you shouldn't add the Javascript: prefix (for onlick or OnClientClick).

If that is set up correctly and it still submits, there may be a javascript error occuring in your validation function. When an error is thrown, the whole onclick event stops immediately, i.e. the return false doesn't get reached, and so the form submits as normal.
Of course, there may also be a logical error somewhere within validation which is returning true when it shouldn't be.


Old June 4th, 2008, 09:40 AM
Registered User
Join Date: Jun 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

see http://forums.asp.net/t/1161858.aspx?PageIndex=1

OnClientClick="if(confirm('Selected records will be deleted?')==false){event.returnValue=false;return false;}else{return true;}"

Similar Threads
Thread Thread Starter Forum Replies Last Post
How ch. 11 examples return false for ctrlKey? horseatingweeds BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 March 18th, 2008 12:01 AM
Javascript return false won't stop post rstelma ASP.NET 1.0 and 1.1 Basics 9 March 16th, 2006 02:25 PM
return (false) crmpicco Javascript 1 October 24th, 2005 11:39 AM
javascript onclick question robs Javascript 1 January 19th, 2005 05:20 AM
Ch7 False Value Return on BuildSQLString Function Olivia54 BOOK: Beginning Access VBA 1 July 11th, 2004 09:22 PM

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