JS Form Validation

Suppose that I use Rails to create an HTML form element.
By that I mean that I have some Ruby code that I call from
within <%= %> and the Ruby code then generates the form
element for me. So what actually gets stuck into the code
might look like this:

It appears that if, on submission, I use JS to validate by checking
to see if element1 is longer than 0 characters, it appears that
JS thinks that element1 is undefined. Am I making some mistake;
or, is that the expected result? If it is the expected result,
anything
I can do so as to be able to validate using JS?

Thanks.

   ... doug

On Jun 2, 2007, at 6:55 PM, doug wrote:

It appears that if, on submission, I use JS to validate by checking
to see if element1 is longer than 0 characters, it appears that
JS thinks that element1 is undefined.

You’ll need an id=“element1” in there for getElementById to work.