Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formX DOM Object? 1

Status
Not open for further replies.

AbidingDude

Programmer
Oct 7, 2012
74
US
Hello, I'm trying to help out IT a bit. We had someone years ago write our purchasing system. They left years ago and left us to figure out the source code. It was written back in approximately 2005. I'm still fairly new to JavaScript, but as I'm going through the code, I keep seeing an object property called formX. It crops up in most functions:
document.formX.dept.value, document.formX.apflag.value, etc.
I tried searching for formX but really didn't come up with anything. Is it exceptionally old? What is the formX property?

TIA
 
Hi

That is probably used as the [tt]name[/tt] attribute of a [tt]form[/tt] tag, like this :
Code:
[b]<form[/b] [maroon]name[/maroon][teal]=[/teal][i][green]"formX"[/green][/i][b]>[/b]

Which can then be used in JavaScript for references like you mentioned :

Feherke.
feherke.github.io
 
I see. I didn't realize the 'name' attribute could be used as an object... I'm slowly learning.
 
Wait... If you can just treat a tag attribute as a DOM element property, it seems like that makes the getElementsByName() function useless.
In your JSfiddle, I would have thought the only way to access that form would have been:
document.getElementsByName("formX")[0]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top