473,395 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to put validation with Javascript in Firefox.

8
hello,
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>

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

}
}

Please help. Thanks
Feb 7 '07 #1
1 1459
kenobewan
4,871 Expert 4TB
Here is an alternate global event:
A global event...in Firefox?

Here is a related thread:
Mouse position in FireFox / NS
Feb 8 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Stephen | last post by:
Hi, Does Validation controls like "Required field validator".... ever work with Netscape or we have to write javascript for either client-side or write server side validation. Please advice....
1
by: NancyASAP | last post by:
Thought I'd share this since it took me a long time to get it working. Thanks to a bunch of contributers in Google Groups who shared javascript, etc. The question was: How can I put a reset...
45
by: Pat | last post by:
its seems asp.net validation doesn't fire when using FireFox? Tested a page and it doesn't fire. It seems the javascript doesn't fire Any ideas?
4
by: goga | last post by:
Hi there, The following simple validation code works in internet explorer but doesn't in firefox. Specifically, in firefox shows the alert message and then loads the action page anyway. Any...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
7
by: Tim_Mac | last post by:
hi, using .net 2.0, i have a web form with lots of textboxes, drop-down-lists etc. There are lots of required field validators and regular expression validators. When i click the 'save' button,...
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
4
by: darrel | last post by:
Our intranet server died a few months ago and we migrated everything over to a new one. When we did that, any app (asp.net 1.1) of ours that depended on client-side navigation just broke. ...
5
by: cbs7 | last post by:
Hi all I'm a complete newbie to web development and Javascript especially. I've been creating a form for a webpage and have used a validation script gen_validatorv2.js which I downloaded from the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.