Here is part of the function:
function updateResponse(question, answer) {
questionId = 'q'+question;
document.forms[0].questionId.value = answer;
Calling the function with something like:
<td onClick='javascript:updateResponse(1, 1);'>
The form element I want it to update looks something like:
<input type='hidden' name='q1' value='' />
Using Firefox web console I get:
TypeError: document.forms[0].questionId is undefined
Thanks!
UPDATE: Found this after much googling and it works. Still seems like there may be a more graceful way to achieve this though?
eval(\"document.forms[0].\"+questionId+\".value = answer;\");
javascript:prefix there..