|
-
Dec 14th, 2000, 08:25 PM
#1
Thread Starter
Lively Member
I have a web page that need validation of input data ..
and i have used onBlur event that calls ValidateField
that checks whether the length of entered data in that
field is greater than certain value(say 3 chars)..
<INPUT NAME="FirstName" TYPE=TEXT SIZE=15 onBlur="validateField(this,3);" >
function ValidateField(field,len)
{
if (field.length < len)
{
alert("Field must be at least " + minLen + "
characters long!");
field.focus();
}
}
But, the problem is, the message keeps coming
infinitely if less characters, say 2 chars is entered..
It goes into infinite message display and it
Is it a browser problem ?
thanks
sarath
-
Dec 15th, 2000, 04:23 AM
#2
Frenzied Member
I'll tell you what the problem is...
you have more than one textbox on your page and you are calling validateField onBlur of both/all of them.
When you enter text in the box 1 and then go to box 2 box one is being validated. setting the focus to box 1 causes box 2 to be validated which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated,which then sets focus to box 2 causing box 1 to be validated, which then sets focus to box 1 causing box2 to to be validated
...and so on!
-
Dec 15th, 2000, 07:00 AM
#3
Thread Starter
Lively Member
thanks mark..is there any way out of it ?
hi mark,
You are perfectly right in saying that two
text boxes are using this valid function.. i tried
writing separate functions and calling them.. Still
nothing happened.. the problem persists..
I tried inserting a dummy text box in between these
successive text boxes .. Still the problem persists..
Is there any way out ??
thanks once again..
sarath
-
Dec 15th, 2000, 07:14 AM
#4
Frenzied Member
It would (probably) be better to do all you field checking last of all.
Is the form going to be posted back to the server? if so, check all the fields before submiting.
-
Dec 15th, 2000, 10:08 AM
#5
Thread Starter
Lively Member
thanks for the suggestion..
hi mark,
thanks..
It is better to check the validations
at the end ..
sarath
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|