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:
<input type="text" name="element1" />
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,
I can do so as to be able to validate using JS?