Tuesday, 17 September 2013

get value of hidden field set by another function

get value of hidden field set by another function

I have a form that has a checkbox that when click, triggers an event in
javascript that assigns a value to a hidden field. However, I cannot
access this when I try to validate the form. It actually causes the entire
script to fail. I've tried to access it with:
var hiddenField = document.forms[myForm].elements[hiddenField].value;
and with:
var hiddenField = document.getElementById('hiddenField').value;
and:
var hiddenField = document.getElementById('hiddenField');
then adding .value to variable when it's actually used in the script. I've
stepped through all of it in firebug and watched the other function assign
the appropriate value to the hidden field. This variable assignment is
actually where the script gets killed. Any help or suggestions would be
greatly appreciated!

No comments:

Post a Comment