Hi,

The line

> $("lang").value = "this is a test";

is fine.  I suspect you may be calling it from inline script (your
quoted code sample does, but I don't know if you were using
shorthand).  Until the DOM is fully loaded, referencing elements by ID
is problematic -- e.g., doing so from inline script.  The dom:loaded
event[1] provided by Prototype can help.

[1] http://prototypejs.org/api/document/observe

Here's a page that successfully sets a hidden form field on load
(using dom:loaded), and then queries it later when you click a button:
http://pastie.org/338053

HTH,
--
T.J. Crowder
tj / crowder software / com

On Dec 12, 7:34 pm, Joel Taylor <joelatay...@gmail.com> wrote:
> Ok, this seems so easy - but I'm having trouble setting a simple input
> field on my page.
>
> <code>
> <input type="hidden" name="lang" id="lang" value="" />
> <script>
> $("lang").value = "this is a test";
> </script>
> </code>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to