473,772 Members | 3,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Possible to check for empty input boxes when names generated dynamically?

Hi, I'm trying to find a way to validate input text boxes where I
don't know the names until the page is rendered. I've got 2 validate
functions that fire with the onsubmit button of a "mini" form within
the html document.

When the Finish button is clicked, I need to check for any empty input
boxes before loading the next aspx page...but it could be no boxes or
five boxes, etc.?

I've included my html output...if you have any ideas, would greatly
appreciate it.

Thanks, Kathy
*******HTML**** *****
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">
<style type="text/css">
bgcolor="#FFFFF F"
h1 {font-family: Gill Sans MT;color: blue;font-size:20pt
font-weight:bold;mar gin-top:0;margin-bottom:0}
h2 {font-family: Gill Sans MT;color: red;font-size:18pt
font-weight:bold;mar gin-top:0;margin-bottom:0}
h3 {font-family: Gill Sans MT;color:
white;font-size:14pt;font-weight:bold;mar gin-top:0;margin-bottom:0}
body {font-family: Gill Sans MT;color: black;font-size:12pt}
p {font-family: Gill Sans MT;color: black;font-size:12pt}
h4 {font-family: Gill Sans MT;color:
white;font-size:12pt;font-weight:bold;tex t-transform:
uppercase;margi n-top:0;margin-bottom:0}
h5 {font-family: Gill Sans MT;color:
white;font-size:12pt;font-weight:bold;mar gin-top:0;margin-bottom:0}
h6 {font-family: Gill Sans MT;color:
black;font-size:12pt;font-weight:bold;mar gin-top:0;margin-bottom:0}
</style>
<title>Exampl e of XSLT</title><script language="Javas cript">
function Anomaly(typeIn, idIn,textIn)
{
newWindow = window.open(('A nomaly.aspx?typ e='+typeIn+'&id ='+idIn+'&text= '+textIn),
'Anomaly', 'width=650,heig ht=700,left=100 ,toolbar=no,men ubar=no,resizab le=yes');
}
function ValidateSave(fo rmRef,fieldName ,min,max)
{
var formField = formRef.element s[fieldName];

if((parseInt(fo rmField.value) != formField.value ) ||
formField.value < min || formField.value > max)
{
alert("The entry must be between " +min+ " and " +max+ ".");
formField.focus ();
formField.selec t();
return false;
}
else
{
return confirm("You are about to enter: " +formField.valu e+ "
-- are you sure?");
}
}
function ConfirmSave(for mRef,fieldName)
{
var formField = formRef.element s[fieldName];

if ((formField.val ue.length==0) || (formField.valu e==null))
{
alert("You are trying to save a blank entry.");
formField.focus ();
formField.selec t();
return false;
}
else {
return confirm("You are about to enter: " +formField.valu e+ "
-- are you sure?");
}
}
</script></head>
<body>
<h1>Test Work Instruction One</h1>
<table border="1" width="100%" cellpadding="4" >
<tr bgcolor="red" valign="middle" >
<th colspan="3" align="left">
<h3>SAFETY</h3>
</th></tr>
<tr>
<td align="center" valign="middle" width="5%"><inp ut style="CURSOR:
HAND" type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S afety','1','Thi s is the first safety
item, the first item to test the format for the wrap around.')"></td>
<td valign="top"><t able border="0"><tr> <td align="left"
valign="top">1. *</td>
<td valign="top"><p >This is the first safety item, the first item to
test the format for the wrap around.</p>
</td></tr></table></td>
</tr>
<tr>
<td align="center" valign="middle" width="5%"><inp ut style="CURSOR:
HAND" type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S afety','2','Thi s is the second safety
item.')"></td>
<td valign="top"><t able border="0"><tr> <td align="left"
valign="top">2. *</td>
<td valign="top"><p >This is the second safety item.</p>
</td></tr></table></td>
</tr>
</table><br><tabl e border="1" width="100%" cellpadding="4" >
<tr bgcolor="orange " valign="middle" >
<th colspan="3" align="left">
<h3>TOOLS AND MATERIALS</h3>
</th></tr>
<tr><td colspan="2"><b> Tool/Material</b></td><td
align="center"> <b>Jabil Part No.</b></td>
</tr>
<tr><td align="center" valign="middle" width="5%"><inp ut
style="CURSOR: HAND" type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('T ool','part no a','Tool A')"></td>
<td valign="top"><t able border="0"><tr> <td align="left"
valign="top">1. *</td>
<td valign="top" width="60%">Too l A</td></tr></table></td>
<td valign="top" width="35%">par t no a</td>
</tr>
<tr><td align="center" valign="middle" width="5%"><inp ut
style="CURSOR: HAND" type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('T ool','part no b','Tool B')"></td>
<td valign="top"><t able border="0"><tr> <td align="left"
valign="top">2. *</td>
<td valign="top" width="60%">Too l B</td></tr></table></td>
<td valign="top" width="35%">par t no b</td>
</tr>
</table><br><tabl e border="1" width="100%" cellpadding="4" >
<tr bgcolor="navy" valign="middle" >
<th align="left" colspan="4">
<h3>PROCESS STEPS</h3>
</th>
<tr onMouseOver="th is.bgColor = '#FFFF99'" onMouseOut="thi s.bgColor =
'#FFFFFF'">
<td align="center" valign="middle" ><input style="CURSOR: HAND"
type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S tep','1','Step one of the work
instruction.')" ></td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">
<table border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">**</td>
<td valign="top">1. **</td>
</tr>
</table>
</td>
<td>
<p>Step one of the work instruction.</p>
</td>
</tr>
</table>
</td>
</tr>
<tr onMouseOver="th is.bgColor = '#FFFF99'" onMouseOut="thi s.bgColor =
'#FFFFFF'">
<td align="center" valign="middle" ><input style="CURSOR: HAND"
type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S tep','2','Step two of the work
instruction.')" ></td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">
<table border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">**</td>
<td valign="top">2. **</td>
</tr>
</table>
</td>
<td>
<p>Step two of the work instruction.</p>
</td>
</tr>
</table>
</td>
</tr>
<tr onMouseOver="th is.bgColor = '#FFFF99'" onMouseOut="thi s.bgColor =
'#FFFFFF'">
<td align="center" valign="middle" ><input style="CURSOR: HAND"
type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S tep','2.1','Ste p two-one goes
here.')"></td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" >
<tr>
<td valign="top" width="77">
<table border="0" cellpadding="0" >
<tr>
<td valign="top" width="77">**</td>
<td valign="top">2. 1**</td>
</tr>
</table>
</td>
<td>
<p>Step two-one goes here.</p>
</td>
</tr>
</table>
</td>
</tr>
<tr onMouseOver="th is.bgColor = '#FFFF99'" onMouseOut="thi s.bgColor =
'#FFFFFF'">
<td align="center" valign="middle" ><input style="CURSOR: HAND"
type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S tep','2.2','Ste p two-two goes
here.')"></td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" >
<tr>
<td valign="top" width="77">
<table border="0" cellpadding="0" >
<tr>
<td valign="top" width="77">**</td>
<td valign="top">2. 2**</td>
</tr>
</table>
</td>
<td>
<p>Step two-two goes here.</p>
</td>
</tr>
</table>
</td>
</tr>
<tr onMouseOver="th is.bgColor = '#FFFF99'" onMouseOut="thi s.bgColor =
'#FFFFFF'">
<td align="center" valign="middle" ><input style="CURSOR: HAND"
type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S tep','2.2.1','S tep two-two-one
here.')"></td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" >
<tr>
<td valign="top" width="147">
<table border="0" cellpadding="0" >
<tr>
<td valign="top" width="147">**</td>
<td valign="top">2. 2.1**</td>
</tr>
</table>
</td>
<td>
<p>Step two-two-one here.</p>
</td>
</tr>
</table>
</td>
</tr>
<tr onMouseOver="th is.bgColor = '#FFFF99'" onMouseOut="thi s.bgColor =
'#FFFFFF'">
<td align="center" valign="middle" ><input style="CURSOR: HAND"
type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S tep','3','Step three of the work
instruction. A test measurement here: ')"></td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">
<table border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">**</td>
<td valign="top">3. **</td>
</tr>
</table>
</td>
<td>
<p>Step three of the work instruction. A test measurement here: <form
name="test_meas ure" action="Validat eSave.aspx" method="post"
onsubmit="retur n ValidateSave(th is,'test_measur e','1','5');">< input
style="CURSOR: HAND" type="text" size="5" name="test_meas ure"
value="">mm**
<input type="submit" value="SAVE"><i nput type="hidden"
name="LoRange" value="1" size="10"><inpu t type="hidden" name="HiRange"
value="5" size="10"></form>
</p>
</td>
</tr>
</table>
</td>
</tr>
<tr onMouseOver="th is.bgColor = '#FFFF99'" onMouseOut="thi s.bgColor =
'#FFFFFF'">
<td align="center" valign="middle" ><input style="CURSOR: HAND"
type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S tep','4','Step four of the work
instruction with a test data collection entry: ')"></td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">
<table border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">**</td>
<td valign="top">4. **</td>
</tr>
</table>
</td>
<td>
<p>Step four of the work instruction with a test data collection
entry: <form name="test_data " action="Validat eSave.aspx" method="post"
onsubmit="retur n ConfirmSave(thi s,'test_data'); "><input style="CURSOR:
HAND" type="text" name="test_data " value="">**
<input type="submit" value="SAVE"></form>
</p>
</td>
</tr>
</table>
</td>
</tr>
<tr onMouseOver="th is.bgColor = '#FFFF99'" onMouseOut="thi s.bgColor =
'#FFFFFF'">
<td align="center" valign="middle" ><input style="CURSOR: HAND"
type="button" value="Anomaly"
onclick="Javasc ript:Anomaly('S tep','5','Last step, number
five.')"></td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">
<table border="0" cellpadding="0" >
<tr>
<td valign="top" width="7">**</td>
<td valign="top">5. **</td>
</tr>
</table>
</td>
<td>
<p>Last step, number five.</p>
</td>
</tr>
</table>
</td>
</tr>
</tr>
<tr bgcolor="red" valign="middle" >
<td align="center" valign="middle" ><input type="button" name="Finish"
value="FINISH" onclick="parent .hidden.locatio n='hidden_birth 2.aspx?finish=y es'"></td>
<td align="left"><f ont color="white">< b>Click the FINISH button when
work instruction is complete.</b></font></td></tr>
</table>
</body>
</html>
Jul 20 '05 #1
3 5177
In article <75************ **************@ posting.google. com>,
Ka**********@at tbi.com enlightened us with...
Hi, I'm trying to find a way to validate input text boxes where I
don't know the names until the page is rendered. I've got 2 validate
functions that fire with the onsubmit button of a "mini" form within
the html document.


(substitute your form name in here)
var l = document.formna me.elements.len gth;
for (var i=0; i<l; i++)
{
var e = document.formna me.elements[i];
if (e.type=="text" )
{
if (isBlank(e))
{
alert("Blank!") ;
return false;
}
}
}
return true;

function isBlank(strObje ct)
{
/* Returns false if the field has any non-space characters, true if
not.
You must pass in an input (text) object (not the value) */
var index;
var myChar;

if (! strObject)
{
return true;
}
else
{
var str = strObject.value ;
}

for (index = 0; index < str.length; index ++)
{
myChar = str.charAt(inde x);
if (myChar != " ")
{
return false;
}
}
return true;
}

-------------------------------------------------
~kaeli~
Hey, if you got it flaunt it! If you don't, stare
at someone who does. Just don't lick the TV screen,
it leaves streaks.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #2
Thanks, Kaeli. Just what I needed.

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
Kaeli, I'm trying to modify your code (without success!) to check
document.all instead of a specific form. I now just need to see if any
input type="text" elements exist, not if they're empty. I won't bore
you with what I've tried cause it don't work!

Thanks again for your help.

Kathy
*************** **
kaeli <in************ ********@NOSPAM att.net> wrote in message news:<MP******* *************** **@nntp.lucent. com>...
In article <75************ **************@ posting.google. com>,
Ka**********@at tbi.com enlightened us with...
Hi, I'm trying to find a way to validate input text boxes where I
don't know the names until the page is rendered. I've got 2 validate
functions that fire with the onsubmit button of a "mini" form within
the html document.


(substitute your form name in here)
var l = document.formna me.elements.len gth;
for (var i=0; i<l; i++)
{
var e = document.formna me.elements[i];
if (e.type=="text" )
{
if (isBlank(e))
{
alert("Blank!") ;
return false;
}
}
}
return true;

function isBlank(strObje ct)
{
/* Returns false if the field has any non-space characters, true if
not.
You must pass in an input (text) object (not the value) */
var index;
var myChar;

if (! strObject)
{
return true;
}
else
{
var str = strObject.value ;
}

for (index = 0; index < str.length; index ++)
{
myChar = str.charAt(inde x);
if (myChar != " ")
{
return false;
}
}
return true;
}

-------------------------------------------------
~kaeli~
Hey, if you got it flaunt it! If you don't, stare
at someone who does. Just don't lick the TV screen,
it leaves streaks.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
3568
by: Adrian Parker | last post by:
I have a PHP generated page which displays X many records. Each record has a checkbox preceding it. The user checks several checkboxes, and hits a delete button. All the corresponding records will be deleted. But I'm running into difficulty... Right now the NAME property of each check box is the primary key of the corresponding record. Hence if I know which checkboxes are checked, I simply use DELETE using the NAME value.
6
4744
by: LRW | last post by:
I have no idea if this is more a PHP question or Javascript question, because my problem hinges equally on both. I have a PHP script that queries a database and creates a list of rows for each item, each with their own checkbox one can select to do stuff later. The PHP script this form posts to creates an array of all the selected checkboxes and does stuff. But, on the form, I want to be able to have the checkboxes auto-check when...
17
2768
by: Dave Smithz | last post by:
Hi there, A PHP application I built has a section which lists a number of members to a club whose names each appear with a check box beside them that can be ticked. These check boxes are part of a form which amongst other submit buttons has a one particular submit button that if checked will send the form data (using GET) to a script that will email all the checked members.
2
3811
by: Stephen Miller | last post by:
I have a page with many, dynamically generated combo boxes and I want to check all of them, before I add a unique value to specific combo. What would be the best way to work through the document and without needing to know the name of each combo box, check its value? Thanks, Stephen
7
1762
by: Buddy Ackerman | last post by:
I created this class Public Class HTMLFileInput : Inherits System.Web.UI.HtmlControls.HtmlInputFile Public Property Data As String Get Return ViewState("HTMLFileInput.Data") End Get Set (ByVal Value As String)
2
1915
by: muthu | last post by:
Hi freinds, In my aspx page i have generated some check boxes dynamically using dhtml. When i check any check box and submit the form,how can i capture the value of check box. How should i identify wich check box is been checked.And the check boxes are not server controls.They are the ordinary html check boxes.Can any one help me out
1
7495
by: vega80 | last post by:
Hi. I have a problem with assigning an onkeypress-function to dynamically created input-boxes.I want to put the content of an input-field into a tag-list when the user hits enter. This works fine the first time (when the input-field is created in a non-dynamical way). The next input-field is created dynamically by a function that is called when the user hits enter (the previously generated input-field will be hidden). Then I'm trying...
10
1857
by: tadisaus2 | last post by:
Hello, I want to have a user to check at least 2 check boxes and NO more than 2 boxes. I have different checkbox names because I stored each nam on different field. I tried this code but nothing happened. Here is my code: function clickCtr(chk){ var ctr = 0; var frm = chk.form; for (var i=1; i<=4; i++){
7
1741
by: phpretard | last post by:
I have columns named -email- rookie- -coach- -minor- R1. email has an address rookie has a value of the word "yes" R2. email has an address coach is empty R3. email has an address minor has a value of the word "yes" OBJECTIVE: When I submit the form with all three boxes check it should only send an email to rookie and minor because their values are "yes"
0
9620
marktang
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...
0
9454
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,...
0
10261
Oralloy
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...
0
9912
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 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...
0
8934
agi2029
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...
0
6715
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();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.