0

I am attempting to retrieve this value from the form, but it isn't returning anything. How should this be fixed? Can anyone point me in the right direction?

function checkForm()
{
  numrows = document.theform.numrows.value;
  if(numrows == -1)
  {
    alert("You have not chosen any options yet");
    return false;
  }

  emailcheckcount = 0;
  for(i=0; i<=numrows; i++)
  {
      var recid = document.theform.recid'+i+'.value; //why is this failing to get value here?
      alert("Test" + recid);
      return false;
  }
}
1
  • 1
    The syntax on this line document.theform.recid'+i+'.value is incorrect. Have you checked the browser logs for any error messages. Consider adding a code snippet of the HTML form where this function is called so someone looking to answer may have more information. Also please specify if you get the alert. If you are using firefox / chrome browser try console.log to print some debug messages. Commented Oct 14, 2015 at 7:47

1 Answer 1

5

Please try to use array to acces the value:

var recid = document.theform.recid[i].value;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.