I have an external js file to validate a form and it works in IE and
Opera, but not Mozilla Firefox.
In Mozilla Firefox, the javascript console sasys "SearchForm " is not
defined in the second line
function Valid() {
if ((SearchForm.Fi rstName.value == "") && (SearchForm.Las tName.value
== "") && (SearchForm.Pho ne.value == "") && (SearchForm.Dep t.value ==
"%")) {
alert("Please enter criteria before submitting.");
SearchForm.Firs tName.focus();
return false;
}
else if (SearchForm.Com pany.value == "") {
alert("Please select a company to search by.");
SearchForm.Comp any.focus();
return false;
}
else
SearchForm.subm it();
}
Any ideas? 8 12728 ne****@gmail.co m wrote:
I have an external js file to validate a form and it works in IE and
Opera, but not Mozilla Firefox.
In Mozilla Firefox, the javascript console sasys "SearchForm " is not
defined in the second line
function Valid() {
if ((SearchForm.Fi rstName.value == "") && (SearchForm.Las tName.value
== "") && (SearchForm.Pho ne.value == "") && (SearchForm.Dep t.value ==
"%")) {
alert("Please enter criteria before submitting.");
SearchForm.Firs tName.focus();
return false;
}
else if (SearchForm.Com pany.value == "") {
alert("Please select a company to search by.");
SearchForm.Comp any.focus();
return false;
}
else
SearchForm.subm it();
}
Any ideas?
Try using the following syntax instead, replace where necessary:
document.forms["SearchForm "].elements["FirstName"].value
document.forms["SearchForm "].elements["LastName"].value
document.forms["SearchForm "].elements["Phone"].value
etc. etc.
<ne****@gmail.c omwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I have an external js file to validate a form and it works in IE and
Opera, but not Mozilla Firefox.
In Mozilla Firefox, the javascript console sasys "SearchForm " is not
defined in the second line
function Valid() {
if ((SearchForm.Fi rstName.value == "") && (SearchForm.Las tName.value
== "") && (SearchForm.Pho ne.value == "") && (SearchForm.Dep t.value ==
"%")) {
alert("Please enter criteria before submitting.");
SearchForm.Firs tName.focus();
return false;
}
else if (SearchForm.Com pany.value == "") {
alert("Please select a company to search by.");
SearchForm.Comp any.focus();
return false;
}
else
SearchForm.subm it();
}
Any ideas?
Are you declaring it; for example:
var SearchForm = document.forms[0];
Or is it the name of the form; as in:
<form name="SearchFor m" ...>
Also, how are you calling your "Valid()" function?
I'm not declaring as it is the name of the form <form name="SearchFor m"
id="SearchForm" ..
I'm calling the Valid function like this:
<a href="#" onClick="Valid( )"><img src="/images/go.gif" alt="Submit"
width="34" height="19"/></a>
McKirahan wrote:
<ne****@gmail.c omwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I have an external js file to validate a form and it works in IE and
Opera, but not Mozilla Firefox.
In Mozilla Firefox, the javascript console sasys "SearchForm " is not
defined in the second line
function Valid() {
if ((SearchForm.Fi rstName.value == "") && (SearchForm.Las tName.value
== "") && (SearchForm.Pho ne.value == "") && (SearchForm.Dep t.value ==
"%")) {
alert("Please enter criteria before submitting.");
SearchForm.Firs tName.focus();
return false;
}
else if (SearchForm.Com pany.value == "") {
alert("Please select a company to search by.");
SearchForm.Comp any.focus();
return false;
}
else
SearchForm.subm it();
}
Any ideas?
Are you declaring it; for example:
var SearchForm = document.forms[0];
Or is it the name of the form; as in:
<form name="SearchFor m" ...>
Also, how are you calling your "Valid()" function?
Changing the syntax fixed it along with changing the call to
Valid(document. Searchform) instead of just Valid()
Thanks for your help guys!
web.dev wrote:
ne****@gmail.co m wrote:
I have an external js file to validate a form and it works in IE and
Opera, but not Mozilla Firefox.
In Mozilla Firefox, the javascript console sasys "SearchForm " is not
defined in the second line
function Valid() {
if ((SearchForm.Fi rstName.value == "") && (SearchForm.Las tName.value
== "") && (SearchForm.Pho ne.value == "") && (SearchForm.Dep t.value ==
"%")) {
alert("Please enter criteria before submitting.");
SearchForm.Firs tName.focus();
return false;
}
else if (SearchForm.Com pany.value == "") {
alert("Please select a company to search by.");
SearchForm.Comp any.focus();
return false;
}
else
SearchForm.subm it();
}
Any ideas?
Try using the following syntax instead, replace where necessary:
document.forms["SearchForm "].elements["FirstName"].value
document.forms["SearchForm "].elements["LastName"].value
document.forms["SearchForm "].elements["Phone"].value
etc. etc.
"nektir" <ne****@gmail.c omwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
I'm not declaring as it is the name of the form <form name="SearchFor m"
id="SearchForm" ..
I'm calling the Valid function like this:
<a href="#" onClick="Valid( )"><img src="/images/go.gif" alt="Submit"
width="34" height="19"/></a>
AFAIK, the proper way to reference it is by
"document.Searc hForm" not simply "SearchForm ".
JavaScript Form Contents http://www.irt.org/script/form.htm
Q299 When referring to my form using form.field.valu e
it does not work, why? http://www.irt.org/script/299.htm
[snip]
"nektir" <ne****@gmail.c omwrote in message
news:11******** *************@e 3g2000cwe.googl egroups.com...
Changing the syntax fixed it along with changing the call to
Valid(document. Searchform) instead of just Valid()
[snip]
function Valid() {
Did you also change the above to the following?
function Valid(SearchFor m) { ne****@gmail.co m wrote:
I have an external js file to validate a form and it works in IE and
Opera, but not Mozilla Firefox.
In Mozilla Firefox, the javascript console sasys "SearchForm " is not
defined in the second line
function Valid() {
if ((SearchForm.Fi rstName.value == "") && (SearchForm.Las tName.value
[...]
>
Any ideas?
It pays to read the FAQ:
<URL: http://www.jibbering.com/faq/#FAQ4_41 >
--
Rob
JRS: In article <11************ **********@h48g 2000cwc.googleg roups.com>,
dated Wed, 4 Oct 2006 16:50:25 remote, seen in
news:comp.lang. javascript, web.dev <we********@gma il.composted :
> Try using the following syntax instead, replace where necessary:
document.for ms["SearchForm "].elements["FirstName"].value document.for ms["SearchForm "].elements["LastName"].value document.for ms["SearchForm "].elements["Phone"].value etc. etc.
var SFe = document.forms["SearchForm "].elements
SFe["FirstName"].value
SFe["LastName"].value
SFe["Phone"].value
should be both faster and smaller.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/>? JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Amir |
last post by:
I'm looking for an example of form validation by JavaScript before it's
processed by a PHP script.
Any help will be appreciated.
|
by: francisco lopez |
last post by:
Yesterday I had a problem with a javascript to validate my form, but
you helped my out yesterday and it works now perfectly!!! so thank
you!!!
the problem I have now is the following:
I put my form now on the server and I changed following lines:
I changed:
form action="mailto:fran@gmx.net"
|
by: mhk |
last post by:
Hi,
Is there any way to create/set Session veriable in JavaScript.
Please let me know if anyone has an idea.
Thanks alot.
|
by: phal |
last post by:
Hi all;
I code Perl for CGI, I using regular expression to check the validation
of user input, because the form is small and it run only from my own
computer, anyways if many people using my form, do you think it will be
slow due to Perl is run under server. How about using JavaSCript to
check validation for user input? Do you think it a bit faster?
|
by: TJS |
last post by:
how do I get "onSubmit" to work in .net ?
<Form id="Form1" name="Form1" method="post" onSubmit="return
validateStandard(this, 'error');" runat="server">
| |
by: mouac01 |
last post by:
I'm new to PHP/Javascript. I have a simple form I want to validate the
fields with javascript and then run the PHP script. All the scripts
are in one page. I want PHP to control where the next page is. It
works fine without the javascript but when I add the javascript the
page doesn't do anything besides the validation. Thanks for your
help... Chong
----login.html--------------------------------
<?php
ob_start();
|
by: daniel.boorn |
last post by:
Form validation using JavaScript has never been as easy and simple! We
have developed a free generic form validation script that can validate
any form with very little JavaScript required in form!
For example:
A normal HTML form with out validation:
<form action="foobar.htm" method="get">
<div>Name: <input type="text" name="customerName" value=""></div>
|
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 appears that the data goes straight to the
processing page, rather than the javascript seeing if data is missing and
popping up an alert. I thought it may be because much of the form is
populated with data from the db (lists, etc.), but when I leave...
|
by: ll |
last post by:
Hi,
I am working with a page that has both cfform elements and 'plain
html' form elements. In particular, I am needing to validate my
textarea form field and my email text field. On one of my html pages,
I have been using a great javascript validation script; however, I am
wondering if I can use that in a coldfusion page? I've included the
javascript I'd been using before.
Thanks for any help you can provide,
Regards,
Louis
|
by: happyse27 |
last post by:
Hi All,
I am creating the perl script using html form(with embedded javascript inside).
When using this html form with javascript alone, it works where the form validation will pop up javascript windows to say the field is not keyed into properly. However, when i convert this html(with javascript inside) into perl script, the perl script did not validate when i keyed incorrect data in the form and it straight away executed perl script...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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,...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |