Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 February 7th, 2007, 05:15 AM
Authorized User
Join Date: Aug 2006
Posts: 39
Thanks: 1
Thanked 0 Times in 0 Posts
Default How to put validation with Javascript in Firefox.


I am trying to validate empty textbox value by javascript in Firefox. It is working fine in IE but not in Firefox.

Note - code is for ASP.NET

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
   if (!IsPostBack)
      Button1.Attributes.Add("onclick", "javascript:checkForm();");

<script type="text/javascript">
  function checkForm()
     if(document.getElementById('txtUserName').value =="")
       if (window.event) //IE
          window.event.returnValue = false;
     else //Firefox
         event.preventDefault(); // <-- What should I write here instead
         //retrun false; is also not working


Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox vs. IE - Javascript problem VerbatimBOT ASP.NET 2.0 Professional 2 September 25th, 2008 03:28 AM
Submit form and validation ind IE 6.0 and Firefox Leholt Classic ASP Basics 2 February 2nd, 2008 11:48 AM
Javascript - Firefox is not supporting lakshmi252002 General .NET 0 April 17th, 2007 12:14 AM
Firefox javascript error akkad Ajax 2 November 27th, 2006 10:57 AM

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