Closed Bug 15729 Opened 25 years ago Closed 25 years ago

[BLOCKER] document.write() has trouble with password and text values.

Categories

(Core :: Layout: Form Controls, defect, P1)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: desale, Assigned: pollmann)

References

Details

document.write() is not printing password.value and text.value. It does print
other unput values like checkbox.value or hidden.value.

BUILDS: 10-06-09 [Apprunner/ Viewer]

STEPS TO REPRODUCE:
1] Please copy code I'm providing, save it as HTML file.
2] Open this file with viewer as well as apprunner.

3] Now follow these three steps for viewer. [Since there are already some
problems with document.write()]

           -Click menu "Style"
           -Take your mouse over "SelectStyleSheet"
           -Now Click "SelectDefault"
           [Above three steps are workaround to see the results printed on
screen with document.write()]
4] Apprunner does not have any workaround like that but it generates same
results as viewer before applying workaround.


EXPECTED RESULTS:
All the inputvalues should get printed. [Inputs in testcase]

Value of input password = passwordvalue
Value of input text = textvalue
Value of input checkbox = checkboxvalue

ACTUAL RESULTS:
It does not print values of textbox and password.

Value of input password =
Value of input text =
Value of input checkbox = checkboxvalue

CODE:

<HTML>
<HEAD>
<TITLE>Value Test</TITLE>
</HEAD>
<BODY >
<FORM NAME="workform">
<INPUT TYPE="password" NAME="testpas" VALUE="passwordvalue" ><br>
<INPUT TYPE="text" NAME="testtex" VALUE="textvalue" ><br>

<INPUT TYPE="checkbox" NAME="testchk" VALUE="checkboxvalue" ><br>
</FORM>
<SCRIPT>
<!--

document.write("Value of input password = ");
document.write(document.workform.testpas.value);
document.write("<br>");

document.write("Value of input text = ");
document.write(document.workform.testtex.value);
document.write("<br>");

document.write("Value of input checkbox = ");
document.write(document.workform.testchk.value);
//-->
</SCRIPT>
</BODY>
</HTML>


END OF CODE:
Assignee: vidur → buster
Attaching a patch for review by buster for a fix. Note that the document.writes
still don't work because of bug 11141, but the content model now has the correct
values.

Index: src/nsGfxTextControlFrame.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp,v
retrieving revision 3.61
diff -r3.61 nsGfxTextControlFrame.cpp
665a666,671
>   else if (mCachedState) {
>     aValue = *mCachedState;
>   }
>   else {
>     GetText(&aValue, PR_TRUE);
>   }
Blocks: 11141
Severity: normal → major
Status: NEW → ASSIGNED
Priority: P3 → P1
Summary: [TESTCASE] document.write() has trouble with password and text values. → [BLOCKER] document.write() has trouble with password and text values.
Whiteboard: fix in hand
Target Milestone: M11
marking this a blocker, since 11141 cannot be fixed without it.
V, I put in the fix you proposed. So consider it code reviewed, and I'll check
it in next oppurtunity.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Whiteboard: fix in hand
eric p. beat me to this fix.
Status: RESOLVED → REOPENED
I tested this one again with todays builds [99-10-19-09], and its not working.
Reopening bug.
Resolution: FIXED → ---
Clearing Resolution.
Assignee: buster → pollmann
Status: REOPENED → NEW
reassigned to eric, since he actually checked in this change for vidur.
Status: NEW → ASSIGNED
Funny, I was working on another bug independently when I came across this
problem - didn't know you and V were working on it too.  :)
Oooh, neat, when I visited your testcase, I got:
Password input
Text input
Checkbox
"Value of input checkbox = checkboxvalue"

Where did the other two sentences go?  Well when I took out the
document.write("<BR>") lines they came back (minus the values, of course).

???  Anyone else seeing this?
Yes, document.write() before <br> tag has some problems. I reported bug for it.
See Bug# 16822
Component: DOM Level 0 → HTML Form Controls
Hardware: PC → All
The problem is mCachedState is only set if js is used to set the value of the
text before the frame is initialized.  The fix is a one-liner to default to
nsFormControlHelper::GetInputElementValue if mCachedState is not set.  This is
already done in GetText.

Buster, Monday you requested people stay out of nsGfxTextControlFrame, can I
check in this fix?
eric:  thanks for asking.  no problem, go ahead and check in.  I'll mirror the
change to my local copy.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
Thanks, checked in.
Status: RESOLVED → VERIFIED
Tested with 10-20-09. Working fine, hence marking verified.
You need to log in before you can comment on or make changes to this bug.