473,800 Members | 2,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Function won't work with two out of 20 textboxes

SC
I have two identical textboxes and two identical images that go are next to
them. Only the names are different. I have onBlur trigger a function to make
sure the boxes were not left empty. If a textbox was left empty, the image
to the left of the box would be a warning icon. If an entry was made in the
textbox, that image would be a transparent GIF. The function works great on
the other 18 form fields. It only fails to work in IE on the first textbox
and one other textbox further down on the page. All textboxes work with the
function in NS.
Here's the function:

<script language="JavaS cript" type="text/javascript">
<!--
// Check for blank text fields and display warning image if blank
function error_check(tex tfield,checkima ge) {
testvalue = textfield.value .toLowerCase();
if (testvalue == 'none' ¦¦ testvalue == 'na' ¦¦ testvalue == 'n/a'){
alert('This fields is required. Please do NOT enter "none", "n/a",
etc.');
textfield.value = "";
textfield.focus ();
} else {
s = textfield.value ;
re = /\s+/g;
str = s.replace(re, "");
if (str.length > 0){
checkimage.src = "images/spacer.gif";
} else {
checkimage.src = "images/icon_warning.gi f";
}
}
}
//-->
</script>

and the form fields are:

<tr>
<td><strong>Pas sword</strong></td>
<td><img src="images/spacer.gif" name="imgpass1" width="17" height="17"
id="imgpass1"> </td>
<td><input name="pass1" type="password" id="pass1" style="width:20 0px"
maxlength="15" onBlur="error_c heck(this,imgpa ss1)"></td>
</tr>
<tr>
<td><strong>R e-Enter Password </strong></td>
<td><img src="images/spacer.gif" name="imgpass2" width="17" height="17"
id="imgpass2"> </td>
<td><input name="pass2" type="password" id="pass2" style="width:20 0px"
maxlength="15" onBlur="error_c heck(this,imgpa ss2)"></td>
</tr>
I cannot figure out why the first one doesn't work, while the second one
does. I also have one other textbox that this function doesn't seem to work
with. It works fine will the other 18 textboxes on the form. This is only
a problem in IE. Any ideas?

Thanks
Jul 23 '05 #1
2 1752
SC
Actually, I fixed the problem with the second textbox that's further down on
the form. The problem seems to be only with the very first textbox, named
"pass1".
"SC" <no*****@thank. you> wrote in message
news:7w******** *********@news. uswest.net...
I have two identical textboxes and two identical images that go are next to
them. Only the names are different. I have onBlur trigger a function to
make sure the boxes were not left empty. If a textbox was left empty, the
image to the left of the box would be a warning icon. If an entry was made
in the textbox, that image would be a transparent GIF. The function works
great on the other 18 form fields. It only fails to work in IE on the first
textbox and one other textbox further down on the page. All textboxes work
with the function in NS.
Here's the function:

<script language="JavaS cript" type="text/javascript">
<!--
// Check for blank text fields and display warning image if blank
function error_check(tex tfield,checkima ge) {
testvalue = textfield.value .toLowerCase();
if (testvalue == 'none' ¦¦ testvalue == 'na' ¦¦ testvalue == 'n/a'){
alert('This fields is required. Please do NOT enter "none", "n/a",
etc.');
textfield.value = "";
textfield.focus ();
} else {
s = textfield.value ;
re = /\s+/g;
str = s.replace(re, "");
if (str.length > 0){
checkimage.src = "images/spacer.gif";
} else {
checkimage.src = "images/icon_warning.gi f";
}
}
}
//-->
</script>

and the form fields are:

<tr>
<td><strong>Pas sword</strong></td>
<td><img src="images/spacer.gif" name="imgpass1" width="17" height="17"
id="imgpass1"> </td>
<td><input name="pass1" type="password" id="pass1" style="width:20 0px"
maxlength="15" onBlur="error_c heck(this,imgpa ss1)"></td>
</tr>
<tr>
<td><strong>R e-Enter Password </strong></td>
<td><img src="images/spacer.gif" name="imgpass2" width="17" height="17"
id="imgpass2"> </td>
<td><input name="pass2" type="password" id="pass2" style="width:20 0px"
maxlength="15" onBlur="error_c heck(this,imgpa ss2)"></td>
</tr>
I cannot figure out why the first one doesn't work, while the second one
does. I also have one other textbox that this function doesn't seem to
work with. It works fine will the other 18 textboxes on the form. This
is only a problem in IE. Any ideas?

Thanks

Jul 23 '05 #2
SC
Nevermind. I fixed it by using

document.getEle mentById(checki mage).src
"SC" <no*****@thank. you> wrote in message
news:7w******** *********@news. uswest.net...
I have two identical textboxes and two identical images that go are next to
them. Only the names are different. I have onBlur trigger a function to
make sure the boxes were not left empty. If a textbox was left empty, the
image to the left of the box would be a warning icon. If an entry was made
in the textbox, that image would be a transparent GIF. The function works
great on the other 18 form fields. It only fails to work in IE on the first
textbox and one other textbox further down on the page. All textboxes work
with the function in NS.
Here's the function:

<script language="JavaS cript" type="text/javascript">
<!--
// Check for blank text fields and display warning image if blank
function error_check(tex tfield,checkima ge) {
testvalue = textfield.value .toLowerCase();
if (testvalue == 'none' ¦¦ testvalue == 'na' ¦¦ testvalue == 'n/a'){
alert('This fields is required. Please do NOT enter "none", "n/a",
etc.');
textfield.value = "";
textfield.focus ();
} else {
s = textfield.value ;
re = /\s+/g;
str = s.replace(re, "");
if (str.length > 0){
checkimage.src = "images/spacer.gif";
} else {
checkimage.src = "images/icon_warning.gi f";
}
}
}
//-->
</script>

and the form fields are:

<tr>
<td><strong>Pas sword</strong></td>
<td><img src="images/spacer.gif" name="imgpass1" width="17" height="17"
id="imgpass1"> </td>
<td><input name="pass1" type="password" id="pass1" style="width:20 0px"
maxlength="15" onBlur="error_c heck(this,imgpa ss1)"></td>
</tr>
<tr>
<td><strong>R e-Enter Password </strong></td>
<td><img src="images/spacer.gif" name="imgpass2" width="17" height="17"
id="imgpass2"> </td>
<td><input name="pass2" type="password" id="pass2" style="width:20 0px"
maxlength="15" onBlur="error_c heck(this,imgpa ss2)"></td>
</tr>
I cannot figure out why the first one doesn't work, while the second one
does. I also have one other textbox that this function doesn't seem to
work with. It works fine will the other 18 textboxes on the form. This
is only a problem in IE. Any ideas?

Thanks

Jul 23 '05 #3

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

Similar topics

5
2923
by: lawrence | last post by:
I've this function, which is the method of a class. I'm posting the constructor of the class down below. For some reason, when I fill out a form and hit submit, I'm not getting any values. Can someone tell me why? function getVar($var="password") { // 05-08-03 - the important thing about this function is it reverses
3
2462
by: Ixnay | last post by:
Hello All, I am trying to add two Text fields together on my Form. But when I run the following code, I get an error that says: ___________ code: ___________ Private Sub sum_click()
58
10188
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
2
1510
by: Samir | last post by:
I don't know if this is easy or not, I have no clue on how to start it. I have Seven different states. I will be having a form with 7 textboxes, and I will enter 7 different states each time in the textbox. When I click on the button, it would call a function the function would output : 6 different combinations of 3 states. So I would have 1-6 and for each would list three states I entered in the textboxes.
3
5057
by: RSB | last post by:
Hi Everyone, I have this TextBox with the TextMode="MultiLine". so now it does not validate the text in the TextBox for the MaxLength SO i have decided to execute a CustomValidator for this Textbox and run a CLientSideFunction. now i was making this clientsidefunction generic so that i can validate all the other textboxes also. Now to do this i need the access to the MaxLength Property, which i am not able to read in the Java...
1
3295
by: Deepson Thomas | last post by:
Hi, How can we identify due to which validator control the Page_ClientValidate() method is returning false. why iam asking this coz in my page iam using lotz of regular expression validators and on the click of button if iam checking whatz the return value of Page_ClientValidate() function iam getting false. Now on click of a checkbox i disables a couple of textboxes. i attached regular expression validators to these textboxes. if...
78
4981
by: Josiah Manson | last post by:
I found that I was repeating the same couple of lines over and over in a function and decided to split those lines into a nested function after copying one too many minor changes all over. The only problem is that my little helper function doesn't work! It claims that a variable doesn't exist. If I move the variable declaration, it finds the variable, but can't change it. Declaring the variable global in the nested function doesn't work...
4
1290
by: billa856 | last post by:
Hi, my project is in MS Access 2002. In that I have one form.In that thare are couple of textboxes and a combobox. now at first i select perticular number from combobox(AutoNo) then it will fetch the value of PalletNo from table and set it as the value of textbox(PalletNo) In my table there entries like AutoNo PalletNo 1 | 21400 2 | 21401 3 | 21402 1 | 21403
2
1170
by: sasimca007 | last post by:
Hello friends, I have one critical doubt on textboxes. That is, I am using modperl and in that within one loop i am giving nof.of text boxes with different names like below: foreach $W($week1,$week2,$week3,$week4,$week5,$week6,$week7) { print "<td align=center><input type='text' name='$code-$testdate' id='reg_box_parent' value='$shcode' size=3 onkeyup='func(this.form,this.name)' maxlength=8>"; } ...
0
9690
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
9550
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
10501
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
10273
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 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...
1
7574
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
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
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
3
2944
bsmnconsultancy
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...

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.