I am using prototype.js
After dynamically generated Input elements when I do
document.getElementById() or $(Id)
I get null.
UPDATE:

I am using prototype.js
After dynamically generated Input elements when I do
document.getElementById() or $(Id)
I get null.
UPDATE:

It seems to me like you did not give any id to your input field. it looks like you only have name attribute. you should give it an id attribute too.
Querying the dom for elements that are dynamicly generated doesn't make a lot of sense.
When you generated the element, save a reference to it. That way your javascript doesn't do a lot of repetitive expensive queries.
To answer you specific question, it should work, and you probably forgot to insert the element into the dom.
As per my knowledge you are suppose to writing your JavaScript at the top of the page but the element will generate after some execution or after the execution of that java script code.
So in that case particular JavaScript code didn't got that element ID; so it will retrieve a null value and send error like that.
If possible just try to call that JavaScript at the bottom of the page OR we can say after page get load.. i think this will work for your same code..
Just try it once, if your luck with you then will get your Element Id.
Thanks.