This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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
Author

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 = '/SecondOptionsAction.do';
var strParams = 'q=' + strValue +"&f=" + oTarget.form.name +"&e=" + oTarget.name;
var loader1 = new
alert('I am in fill territory function');
net.ContentLoader(url,FillDropDown,null,"POST",strParams);
}
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');
for(i=0;i<xRows.length;i++){
var theText = xRows[i].childNodes[0].firstChild.nodeValue;
var theValue = xRows[i].childNodes[1].firstChild.nodeValue;
var option = new Option(theText,theValue);
objDDL.options.add(option,objDDL.options.length);
}
}
</script>
</head>
<body>
<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>
<html:select property="ddlTerritory" styleId="Select2"></html:select>
</html:form>
</body>
</html:html>
------------------
I will be really thankful to you.
Regards,
Roshani
[ September 10, 2006: Message edited by: RoshaniG Gopal ]

Regards,<br />Roshani
Anay Nayak
Greenhorn

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

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

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: document.Form1 has no properties error
 
Similar Threads
reponseXML empty Ajax/Struts
readyState=4 and Http 404 error in Ajax /Struts
how to set option to default ?
Error:"Component returned failure code
Problem with Ajax Double Combo