views:

174

answers:

1

Maddening problem here.

When my page loads: <body onload="getClientDateTime();">

It runs this function: document.getElementById('ClientDateTime').value="hello world";

Which theoretically should insert "hello world" into a hidden field: <INPUT TYPE="hidden" name="ClientDateTime" id="ClientDateTime" value="">

But she no worky.

If I change the field to type "text" then it works like it should but not as a "hidden". Please help!

+1  A: 

This actually works as it alerts the correct value:

<html>
<head>
    <title>Test</title>
</head>
<body onload="document.getElementById('ClientDateTime').value='hello world'; alert(document.getElementById('ClientDateTime').value);">

<input type="hidden" name="ClientDateTime" id="ClientDateTime" value="" />

</body>
</html>
Darin Dimitrov
Yes, that alerts the correct value, but the hidden field's value is still blank. So when I got to submit this form, there is nothing in there.
joel
Maybe just because the source code isnt' changed that it's still really in there? I'm going to run a test and see...
joel
Yep, it was actually changed, just not in the View Source. Thank you!
joel