Jump to content

Variable inside if statement


vchris

Recommended Posts

function validateForm(thisForm) {	var extraValue = thisForm.extra.value;			if(extraValue > 0) {		for(i = 1; i <= extraValue; i++) {			if(thisForm.extraEmail_i.value == '') {				alert('Extra e-mail ' + i + ' is required.');			}		}	}}

As you can see I have thisForm.extraEmail_i.value. I want to validate many text inputs I have (0-8). So basically all I want is the _i to be evaluated by JS (take the value of i in the loop). In CF you add #, how can that be done in JS?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...