nikko50
05-05-2008, 12:30 PM
Hi all. I have the below function to validate a text field. On one page this charge account field is duplicated for several rows and is named "charge[]". How can I alter the below function to validate each row if each field is named the same.?
//VALIDATE CHARGE
if(theForm.charge){
if(!theForm.charge.value.match( /(^\d{5}$)|(^\d{6}$)|(^\d{6}-\d{6}$)/) ){
alert("Please input a valid Charge Account!")
theForm.charge.style.backgroundColor='pink';
theForm.charge.focus();
return false
}}
//VALIDATE CHARGE
if(theForm.charge){
if(!theForm.charge.value.match( /(^\d{5}$)|(^\d{6}$)|(^\d{6}-\d{6}$)/) ){
alert("Please input a valid Charge Account!")
theForm.charge.style.backgroundColor='pink';
theForm.charge.focus();
return false
}}