Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » myForm.appendChild(domElement) doesn't work
icon9.gif  myForm.appendChild(domElement) doesn't work [message #662216] Tue, 29 March 2011 18:26 Go to next message
g-dawg  is currently offline g-dawg Friend
Messages: 2
Registered: March 2011
Junior Member
I have the following javascript in my app
function addDataField(frmObj, typeStr, nameStr, valueStr){
  alert(document.getElementsByTagName("form").length + " forms exist");
  var fld = document.createElement("input");
  fld.type = typeStr; = nameStr;
  fld.value = valueStr;
  alert("input field created");  // <-----  This displays fine
  alert(document.getElementsByName(nameStr)[0].name + "\n" + 
      document.getElementsByName(nameStr)[0].value); // <----- This never displays in Eclipse debugger

This functionality works wonderfully in IE and FF - but not in the Eclipse debugger tab. My big issue is that I'm trying to debug the PHP code that follows this functionality and I NEED this to function in order for the PHP to get the proper POST data. This could be a configuration issue (probably is) but I haven't been able to figure out why all of my other javascript is working but this one function/method is not.

[Updated on: Tue, 29 March 2011 19:19]

Report message to a moderator

Re: myForm.appendChild(domElement) doesn't work [message #662281 is a reply to message #662216] Wed, 30 March 2011 05:01 Go to previous message
Toshihiro Izumi is currently offline Toshihiro IzumiFriend
Messages: 360
Registered: July 2009
Location: Japan
Senior Member
>This functionality works wonderfully in IE and FF
Really? 'appendChild'-'getElementsByName' sequence doesn't work well in IE. (not knowing IE9)
<script type="text/javascript">
	var fld = document.createElement("input"); = "test";

I got 0 on IE. (IE8 on WindowsXP)
This is known issue and you can see the solution at 9.aspx
<script type="text/javascript">
	var fld1 = document.createElement("input"); = "test1";
	var fld2 = document.createElement("<input name='test2'>");

I got 0 and 1.
However, this is too bad since it violates DOM spec.(It causes "String contains an invalid character" exception on Firefox)

'getElementById' resolve it.
Previous Topic:How to connect to my local database server
Next Topic:Installation, grey screen when opening file
Goto Forum:

Current Time: Wed Apr 25 03:20:44 GMT 2018

Powered by FUDForum. Page generated in 0.02053 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software