This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes document.Form1 has no properties error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "document.Form1 has no properties error" Watch "document.Form1 has no properties error" New topic

document.Form1 has no properties error

RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi all,
I am facing this problem and i dont know how to get rid of it. Please help me. When i call the method FillTerritory in the HTML it works(i replaced by a alert) but i get this error (document.Form1 has no properties). I searched but i couldnt find my mistake..
<script type="text/javascript">
alert('I am in double combo ajax in action');
function FillTerritory(oElem,oTarget){
var strValue = oElem.options[oElem.selectedIndex].value;
var url = '/';
var strParams = 'q=' + strValue +"&f=" + +"&e=" +;
var loader1 = new
alert('I am in fill territory function');
function FillDropDown(){
var xmlDoc = this.req.responseXML.documentElement;
alert('before xsel');
var xSel = xmlDoc.getElementsByTagName('selectElement')[0];
alert('before strfname 0');
var strFName = xSel.childNodes[0].firstChild.nodeValue;
alert('before strfname 1');
var strEName = xSel.childNodes[1].firstChild.nodeValue;

var objDDL = document.forms[strFName].elements[strEName];
objDDL.options.length = 0;

var xRows = xmlDoc.getElementsByTagName('entry');
alert('I am in Fill Drop Down function');
var theText = xRows[i].childNodes[0].firstChild.nodeValue;
var theValue = xRows[i].childNodes[1].firstChild.nodeValue;
var option = new Option(theText,theValue);
<html:form action="/SecondOptionsAction" styleId="Form1">
<html:select property="ddlRegion" onchange="javascript:FillTerritory(this,document.Form1.ddlTerritory)" styleId="Select1">
<html ption value="-1">Pick A Region</html ption>
<html ption value="Eastern">Eastern</html ption>
<html ption value="Western">Western</html ption>
<html ption value="Northern">Northern</html ption>
<html ption value="Southern">Southern</html ption>
<html:select property="ddlTerritory" styleId="Select2"></html:select>
I will be really thankful to you.
[ September 10, 2006: Message edited by: RoshaniG Gopal ]

Regards,<br />Roshani
Anay Nayak

Joined: Aug 15, 2006
Posts: 26
Instead of document.Form1 try using document.forms[0] or document.forms['Form1'].
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Does not look like you are assiging your form a name. so use the form array as suggested with the index of 0.

subject: document.Form1 has no properties error
jQuery in Action, 3rd edition