Link to home
Start Free TrialLog in
Avatar of tsynnott
tsynnottFlag for United States of America

asked on

Firefox 3.0.10 no longer processing a javascript function

The following function worked in previous versions of Firefox and continues to work in both IE and Google Chrome. The function calls a window that contains a dbase-generated list used to define a database query. Firefox doesn't  even recognize the alerts. Can someone can take a look at the script and flag the stuff that might cause Firefox to choke?
function dmsJS_displayKeywordPickList(form,fieldName,controlType) {
alert("test0");
	var newWin
	var doc
 
alert("test1");
//	alert("name=" + form.name)
//	alert("fieldName=" + fieldName + " controlType=" + controlType)
 
	// Check for netscape browser
	if(document.all)
	   var xMax=screen.width, yMax=screen.height;
	else //IE browser
	   if(document.layers)
	      var xMax=window.outerWidth, yMax=window.outerHeight;
	   else
	      var xMax=640, yMax=480;
 
	var xOffset=(xMax-200)/2, yOffset=(yMax-200)/2;
 
alert("test2");
	newWin = window.open('','wDmsKeyList',
	  'top='+yOffset+',left='+xOffset+',screenX='+xOffset+',screenY='+yOffset+',titlebar=no,toolbar=no,scrollbars=yes,status=no,width=420,height=350,resize=yes')
	
	doc=newWin.document
	doc.write("")
	doc.close()
 
	doc.write("<html>" + "\n")
	doc.write("<head>" + "\n")
	doc.write("<META HTTP-EQUIV='Expires' content='Sunday, 01 Jan 1995 12:00:00 GMT'>")
	doc.write("</head>" + "\n")
	doc.write("<title>Falcon/DMS</title>" + "\n")
	doc.write("<body bgcolor='' onLoad='javascript:document.dmsKeywordList.submit()'>\n")
	doc.write("<table width='100%' height='100%'>")
	doc.write("<tr><td align='center'><font face='Arial' color='BLACK' size=4>")
	doc.write("<b>Building List<br>Please Wait...</b></font>\n")
	doc.write("</tr></td>")
	doc.write("</table>")
	doc.write("<form action='/scripts/falcon/dmsWebLists2.exe' name='dmsKeywordList' Method='Post'>" + "\n")
	//doc.write("<form action='/scripts/falcon/dmstest.exe' name='dmsDirList' Method='Post'>" + "\n")
	doc.write("<input type='hidden' name='sessionid' value='" + "userid" +"'>\n")
	doc.write("<input type='hidden' name='cmd' value='getKeywordList'>\n")
	doc.write("<input type='hidden' name='formName' value=" + form.name + ">\n")
	doc.write("<input type='hidden' name='fieldName' value=" + fieldName + ">\n")
	doc.write("<input type='hidden' name='controlType' value=" + controlType + ">\n")
	for(var ict=0; ict < form.elements.length; ict++) {
	   // Process text fields
	   if(form.elements[ict].name.substring(0,4) == 'dir_'){
	   	//Sumbit the directory level values for the autoGenerate
		if(controlType == 5  || controlType == 8){
			doc.write("<input type='hidden' name='" + form.elements[ict].name + "' " + 
		  	"value='" + form.elements[ict].value + "'>\n")
		}
	   }
	   if(form.elements[ict].name.substring(0,7) == 'keyword' ||
		form.elements[ict].name.substring(0,5) == 'ffmtk'){
	   	//Sumbit the keyword values for any hiearchical keywords
		if(controlType == 4 || controlType == 5 || controlType == 6 || controlType == 8){
			doc.write("<input type='hidden' name='" + form.elements[ict].name + "' " + 
		  	"value='" + form.elements[ict].value + "'>\n")
		}
	   }
	   if(form.elements[ict].name == 'file_format' ||
		form.elements[ict].name == 'drawing_status'){
	   	//Sumbit values needed for auto-generate
		if(controlType == 5 || controlType == 8){
			doc.write("<input type='hidden' name='" + form.elements[ict].name + "' " + 
		  	"value='" + form.elements[ict].value + "'>\n")
		}
	   }
 
	} // end for
 
	doc.write("</form></body></html>")
	doc.close()
	newWin.focus()
	//doc.dmsDirList.submit() did not work on the MAC, switch to body onLoad
 
	//return false
}

Open in new window

Avatar of abel
abel
Flag of Netherlands image

Can you show the same code with the <script> and the html code that comes with it so that we can test it and amend it?

(btw & OT, the document.all is supported by IE, not by netscape, which used to support document.layers, your if statement is the other way around, but that's only a comment, and does not involve code execution).
If the first alert is not executing, the error is either the code prior to the function call or the function is not being called. If other browsers are still working, I would guess the former so I would check that the code is executing up to the point of the call.

I tested the script. At least the first few lines are executing in FF3, so that enforces that the error is prior to the function call.
Avatar of tsynnott

ASKER

abel and dlastlee
Thanks for your attention to this issue (sorry it took so long to respond).

Before I proceed further with your recommendations, I discovered something that may add to your understanding of my problem: The search form that produces the problem I described is programmatically generated using a 'template' html file that with the xhtml-strict.dtd DocType declaration in the header (one of our client's 508 compliance requirements).

During my latest troubleshooting, I changed the DocType to the transitional declaration, which didn't work, and then to <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">, which did work! I talked to one of my programmers about this and it was suggested that the problem probably relates to how the form's name/id is being processed, and that the problem will be addressed in the coming version release. Based on this information, if you can think of anything else I would appreciate hearing from you. In the meantime, we're probably just going to go with changing the DocType for that form and address the problem more completely in the next release.

Regards,
tsynnott
ASKER CERTIFIED SOLUTION
Avatar of dlastlee
dlastlee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial