Closed Bug 286477 Opened 19 years ago Closed 17 years ago

mishandling of javascript form setting

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: jonesmw, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

javascript:
function func1()
{
editeventform.eventtitle.setAttribute('value', 'testdata1');//line A1
editeventform.eventdesc.innerHTML= 'testdata2';//line A2
}
function func2()
{
editeventform.eventtitle.setAttribute('value', 'testdata3');//line B1
editeventform.eventdesc.innerHTML= 'new set of data';//line B2
}
function func3()
{
editeventform.eventtitle.setAttribute('value', 'testdata1');//line C1
editeventform.eventdesc.innerHTML= '                  ';//line C2
}

HTML on page:
<form name="editeventform" action="event.php" method="post">
	<BR>Title<input type=text name=eventtitle>
	<BR>Description
	<BR><textarea rows=4 cols=30 name=eventdesc></textarea>
	<BR><input type=submit name=submit value="Save">
</form>

When using javascript to dynamically set the data in a form, Line A2 and B2 have
problems, but Line A1 and B1 have no such problems at all.  When i execute
func1() the data 'testdata2' gets put into the textarea it simply displays it in
the background of the textarea.  Its really funky.  Then if you run func2() it
overlays 'new set of data' overtop of the 'testdata2' text and you can't read
anything.  if you run func3(), it overlays blanks ontop the the text in the
background of the textarea.  If you run func2() again, and try to type text in,
because 'new set of data' is in the background canvas of the textarea, any text
you type in is overlayed on top of the phrase 'new set of data'.

Internet Explorer has no problem with this.

Reproducible: Always

Steps to Reproduce:
1. see above
2.
3.

Actual Results:  
see above

Expected Results:  
the javascript on A2, B2, and C2 as shown above should not be printing a picture
of text to the background but instead should be making a live edit to the form
data like A1, B1, and C1 for a input type=text instead of a textarea.
Bug also present in 1.0.6

I tried to work around it by using DOM functions:
  Copy content (text childnodes) from a DIV (obj) to a TEXTAREA (obj2)

  if (document.getElementById) {  //check if getElementById is supported
    var ob = document.getElementById(obj); //get objects
    var ob2 = document.getElementById(obj2);
    if (ob && ob2) {  //if both exist
      var numchilds = ob2.childNodes.length; //get # childs of textarea
      for (var i=0; i<numchilds; i++) {
        ob2.removeChild(ob2.childNodes[i]);  //remove each child
      }
      var theTextOfTheParagraph =
document.createTextNode(ob.childNodes[0].nodeValue);  //create text node
        ob2.appendChild(theTextOfTheParagraph);  //append it to textarea
    }
  }

You can change content of textarea as much as you want with javascript, but as
soon as anything gets typed in javascript produces all kinds of problems.
Assignee: bross2 → nobody
Can either of you reproduce this using Firefox 2.0.0.3 with a clean profile?

http://kb.mozillazine.org/Profile_Manager
Whiteboard: CLOSEME - 04/15/07
With no updates from either of the two people who saw, this, I'm going to close this bug as INVALID (for lack of info). If you can answer the question in comment 2 and still see this bug, please reopen. Also, a testcase attached to this bug would be beneficial.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
Whiteboard: CLOSEME - 04/15/07
You need to log in before you can comment on or make changes to this bug.