Error: document.FormName.FieldName is null or not an object. What the..?!

Hi,
   I have a little form that has 3 textboxes and one textarea. I have previously run a query in ColdFusion to get the data that will populate these text boxes. When the form loads initially, I want the first record from the query to be displayed in the text boxes. With this form there are also 'left' and 'right' buttons to be used to navigate through the record set. There is also an update button so users can update the records. To make the data available in Javascript I output each element to a different array. There is no problem with any of this part of the form. However, when I try to set the values of each text box I get the following  error:  "document.FormName.FieldName is null or not an object. " Where FormName is the name of the form and FieldName is the name of the specific textbox. for example:

document.UpdateUserForm.EditFirstName.value = FirstNameArray[CurrentCount];
document.UpdateUserForm.EditLastName.value = LastNameArray[CurrentCount];
etc...

but this returns the error. So is there a problem with how I am referencing this? Or does it have to do with the form not being 'submitted' initially? Or something else? Thanks for your help!
LVL 1
RoentgenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

devicCommented:
hi Roentgen,

move this:
document.UpdateUserForm.EditFirstName.value = FirstNameArray[CurrentCount];
document.UpdateUserForm.EditLastName.value = LastNameArray[CurrentCount];

after </form>

OR

make function and call it with onload event:
===============================
<body onload=makedefaults();>
<script>
function makedefaults()
{
    document.UpdateUserForm.EditFirstName.value = FirstNameArray[CurrentCount];
    document.UpdateUserForm.EditLastName.value = LastNameArray[CurrentCount];
}
</script>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RoentgenAuthor Commented:
Well, that did it. Thanks! I'm sure that was an easy 100 points. :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.