Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Why won't this work????


  • From: javascript@xxxxxxxxxx (Cutter (JavaScript))
  • Subject: [Javascript] Why won't this work????
  • Date: Wed, 29 Jan 2003 21:11:48 -0800

Thanks Peter, worked like a charm (few other bugs, but I got 'em)

Cutter

Peter Brunone wrote:

>   Ah, the age-old problem of shared indices... this one still bites me every now and then.
>
>   You are using the variable "i" to denote an index of the fieldnames array... but then when you go to check for bad characters, you are using that same variable as the loop index... so as soon as you need to check for that, your i value jumps to 23.  Make it "j" or something else, and your problem will go away.
>
>Cheers,
>
>Peter
>
>---------- Original Message ----------------------------------
>From: "Cutter (JavaScript)" <javascript@xxxxxxxxxxxxxxxxxxxx>
>Reply-To: javascript@xxxxxxxxxx
>Date: Wed, 29 Jan 2003 14:48:12 -0500
>
>  
>
>>The script is to loop through the "fieldnames" array to validate each 
>>field specified. Each "Item" of the "fieldnames" array is an array:
>>
>>Fieldname, FieldType, ErrorMessage, ValidateForBadCharacters, 
>>ValidateAnEmailAddress
>>
>>I started by just checking for "isEmpty", which is working fine. Then I 
>>began testing for bad characters (checkChar). This took a little 
>>tweeking, but now it's working fine. Then I began to test the email.
>>
>>Ouch! Process stops here: check if "isEmpty", then check if it needs a 
>>character check (blValChar) and if it does then do it (checkChar). Then 
>>check if the field needs an address validation (blValMail)...
>>
>>This is where it stops. It gets to "phone", sees that it is not empty, 
>>then does the first boolean (blValChar) and since it does it performs 
>>the character check (checkChar). Then it goes to check if it requires 
>>address validation (blValMail)...and it breaks. The "blValMail" function 
>>(for the first time) throws an error stating that 'Item.4' is null or 
>>not an object.
>>
>>I can't figure it out, it's been driving me nuts for hours now. Any help 
>>is greatly appreciated...(Here's the basic form)
>>    
>>
><snip>
>  
>
>>Peter Brunone wrote:
>>
>>    
>>
>>>What does it do when it chokes?  Any error message?  Where do you call it, and can we see the form you're using as well?
>>>
>>>-Peter
>>>
>>>---------- Original Message ----------------------------------
>>>From: "Cutter (JavaScript)" <javascript@xxxxxxxxxxxxxxxxxxxx>
>>>Reply-To: javascript@xxxxxxxxxx
>>>Date: Wed, 29 Jan 2003 14:07:19 -0500
>>>
>>> 
>>>
>>>      
>>>
>>>>I've created a form validation script, but for some reason it keeps 
>>>>choking after it does the 8th field the second time around. Anyone???
>>>>        
>>>>
>_______________________________________________
>Javascript mailing list
>Javascript@xxxxxxxxxx
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>