Say I have 4 forms, all four have different numbers of text boxes. is there
a script that I can use to check to make sure everything on the form is not
blank?
Jul 23 '05
10 1385
Everything is going terrific!! Just to let you know that everything works.
You have been a great help.
"Mick White" <mw******@BOGUS rochester.rr.co m> wrote in message
news:A5******** ***********@twi ster.nyroc.rr.c om... Samir wrote:
One more thing
Is it possible to put some kind a flag on a field so that the validation does not check it(non required field)?
I would add a suffix to the name or the id:
name="zipREQ"
if(document.for ms[f][k].type=="text" && document.forms[f][k].value=="" && document.forms[f][k].name.indexOf(" REQ") != -1 )
Mick
"Mick White" <mw******@BOGUS rochester.rr.co m> wrote in message news:k9******** ***********@twi ster.nyroc.rr.c om...
Samir wrote:
Thanks, it works perfect.
One more thing, is it possible to add a description to a textbox so
that
the warning can tell them what field it is??
Yes it's possible (in most browsers), you could,for example, change the empty field's background to shocking pink if you like. Where would you like the description/warning to appear?
does this also work for drop
downs as well right?
No, but you can make sure that something is selected, or more precisely, if the selection has a value:
if(document.f orms[f][k].type=="select-one" &&
!document.forms[f][k].value){
alert("Sele ct something from the "+document.form s[f][k].name+" menu"); return false; }
Ur if you use the first slot in all of the menus for something like "Select a ... ", you could rewrite the preceding code:
if(document.f orms[f][k].type=="select-one" && !document.for ms[f][k].selectedIndex) {alert( ...}
See if you can incorporate the code above into your page, let me know if you get stuck.
Do all 4 of these forms get submitted at some point? I'm curious.
Mick
Original function below.
function verifyNoBlankEn tries(){
//Loop through forms: var f= document.forms. length; while(f--){
// loop through each form control: fc=document.f orms[f].length; for(k=0;k<fc; k++){
// look for empty text boxes if(document.f orms[f][k].type=="text" && document.forms[f][k].value==""){ alert("empt y field");documen t.forms[f][k].focus();return false; } } } return true; }
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Philip D Heady |
last post by:
Hi, I'm validating a simple form for input via post ($PHP_SELF). Near the
end I check for username and password. I'm using simple if, elseif, else
statements.
I require them to enter password twice and check that they match. Problem is
script doesn't valide past username input and I dont know why!! If you don't
enter a password it doesn't do the validation anymore, it just dies for some
reason. I would greatly appreciate anyones help,...
|
by: Toni Mcintyre |
last post by:
i'm having 2 problems with the http://validator.w3.org
1. if i have:
<meta http-equiv="Content-Script-Type" content="text/javascript">
then why do i need <script type=text/javascript> everywhere???
i'm writing most of my code by hand, so this is a lot of extra typing or
global search and replace later
2. the other problem is with my include files:
i usually <script src="foo.js"></script>
|
by: mike |
last post by:
Hello,
After trying to validate this page for a couple of days now I was
wondering if someone might be able to help me out. Below is a list of
snippets where I am having the errors.
1. Line 334, column 13: there is no attribute "SRC"
<bgsound src="C:\My Documents\zingwent.mids">
You have used the attribute named above in your document, but the document
type you are using does not support that attribute for this element. This
error is...
|
by: Claire Lescarret |
last post by:
Hello,
I have devoted my time to write valid html 4.01 strict, and CSS-1 and 2
*but* I also have to use third party's code for webcounter (StatCounter) and
Google's SiteSearch, which are preventing my pages from validating.
I woudn't like to take away those services, but I also would like to show my
valid pages... Any suggestions will be greatly appreciated!
Thanks in advance.
|
by: and |
last post by:
Hi
I have been validating all day most things are cool but I cant get by this
problem.
One I have listed the script (JAVASCRIPT ) in all the right placesnot a prob
but the validator insists on going through t findind < (less than) in the
code.
why is it going through the script the scripts been tagged correctly?
Also in the body where the link to the script is there is a table givng
| |
by: Scott Natwick |
last post by:
I am having trouble validating that a selection has been made from a
RadioButton.
I created a script to trigger from a CustomValidator, however, it only works
when I run the app locally, from the debugger. Once I upload it to the
server and run, the script no longer triggers.
Any ideas?
Thanks in advance,
|
by: PapaRandy |
last post by:
Hello,
I am trying to validate the following .py webpage as HTML (through
W3C).
I put:
-----------------------------------------------------------------------------
print "Content-type: text/html; charset=utf-8"
|
by: mickey0 |
last post by:
hello, validating this file on w3c I have many error:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="java.js"></script>
|
by: phpmagesh |
last post by:
Hi
I am creating login page with validation.
i have index.php page with login box, for validating this login detail i m redirecting to login_validate.php.
Login_validate.php file code:
<?php
|
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: 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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: 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...
| |