Jump to content

Variable inside if statement


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...