File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Getting a form name from the select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Getting a form name from the select" Watch "Getting a form name from the select" New topic
Author

Getting a form name from the select

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

There are two selects in a form called Form1, respectively called firstSelect and secondSelect.
The firstSelect has an onchange event defined like this:
<select name="firstSelect" onchange="changVal(this, document.myform.secondSelect)">

When the value changes, changVal(oElem,oTarget) is called.
In changVal(), calling alert(oTarget.form.name) will display the form name Form1.

Can you please explain this ? I can't see anything about Select components having a property called form in the HTML Specification. Maybe I'm looking at the wrong spec.

(For those who own Ajax In Action, please refer to Listing 9.2, page 333)


[My Blog]
All roads lead to JavaRanch
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10290
    
168

Had a look at the MSDN reference, select does have a attribute named form:

select in HTML

Specifically,
form attribute on HTML Object


[My Blog] [JavaRanch Journal]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Thank you.
Referring to the link you've posted, I've figured out that it was part of Document Object Model HTML.
http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-94282980
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting a form name from the select