Closed Bug 53673 Opened 24 years ago Closed 21 years ago

multiline textbox does not accept initial value

Categories

(Core :: XUL, defect, P4)

x86
Windows NT
defect

Tracking

()

RESOLVED FIXED
mozilla1.6beta

People

(Reporter: arthur.barrett, Assigned: neil)

References

Details

(Keywords: polish)

Attachments

(9 files, 1 obsolete file)

<textfield multiline="true" cols="80" rows="5" id="resstr" value="this initial 
value does not appear (for me) but I dont know why"/>

says it all...
Could you attach a test case to the bug? Correcting component, -> HTML Form Controls
Assignee: trudelle → rods
Component: XP Toolkit/Widgets → HTML Form Controls
QA Contact: jrgm → ckritzer
Surely NOT HTML!  XUL.  Will attach a .XUL file to make it clear.
Component: HTML Form Controls → XP Toolkit/Widgets: XUL
<html:textarea> does not take a value="" attribute, so I thought it was 
definite to XUL.

But yes, <html:textarea>blah</html:textarea> exhibits the same behaviour in a 
XUL file.

started with mozilla -chome chrome://blah

will attach updated test set
Yeah, this works correctly for <textarea>foo</textarea> in HTML documents, but
not for <html:textarea>, or the <textarea> XBL binding (which is what 
<textfield multiline="true"> actually maps to in xulBindings.xml). 
It really needs to look at the child text nodes to initially set the .value
property, but updating the .value property seems to work correctly (not 
sure how the binding really works myself). 

-> Ben, the binding meister
Assignee: rods → ben
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: multiline textfield does not accept value → multiline textfield does not accept initial value
So if I want to go bug hunting is this the place to start ?

http://lxr.mozilla.org/mozilla/source/xpfe/global/resources/content/xulBindings.
xml#357 

Also I do not understand how 
http://lxr.mozilla.org/mozilla/source/xpfe/global/resources/content/xulBindings.
xml#242 binds textarea to textfield multiline="true" since it is not inherited 
and it is not an implemented property.  Suppose I dont really have to 
understand, but it'd be nice.
XPAPPs & XPToolkit are jrgm's area
Assignee: ben → jrgm
Sigh ... (ckritzer's been into the rum and egg-nog again).
Assignee: jrgm → ben
QA Contact: ckritzer → jrgm
Okay, not only am I an idiot, I'm an embarrassed idiot.

Sorry guys, I meant to change the QAContact, not Assigned field.
Looks like bug 42646. This belongs to hyatt really.
the <html:textarea> part of the last testcase works for me on bugzilla, but not
on a local file (wonder why, really)
the <textfield multiline="true"> part of the last testcase never works.
CC'ing jst and rods, because when I use setAttribute("value", ...) and
.value=..., it works just fine. So for some reason the setter fails when first
creating the textfield, but succeeds later on. Strange.
Attached file reduced testcase
Is it possible to get this a target milestone of 9.x ?

This is an important bug for me since I am developing software which uses 
Mozilla/XUL, I know it doesnt affect the API, but still....

Dunno if ben has even looked at this.  Cc'ing hyatt, pinging ben.

/be
(This is now called a <textbox multiline="true", just to clarify). 

You could have a look at the definition of the XBL for this widget, and 
get it to properly support the 'value' attribute. But, as a workaround,
you can set the value, in an onload handler or otherwise (do you really 
need to statically set the value in the initial xul file?).
Summary: multiline textfield does not accept initial value → multiline textbox does not accept initial value
Status: NEW → ASSIGNED
Priority: P3 → P4
Target Milestone: --- → mozilla1.0
-> hyatt
Assignee: ben → hyatt
Status: ASSIGNED → NEW
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Morrison ->  i.e. if you want to set the value from an RDF DataSource. in this 
case the value is set dinamically in the initial xul file, but not with 
an onload handler.
*** Bug 122785 has been marked as a duplicate of this bug. ***
for someone who needs this feature. 
You can solve this trouble temporally this way: 

Create a xbl binding that extends from
chrome://global/content/bindings/textbox.xml#textarea;

Constructor of the binding must have this line:

this.value = this.getAttribute("value");

In addition you must define a css style for the binding in order to display it
like a xul textbox with a multiline attribute. 
Attached file another test case...
Attached patch Proposed patch (obsolete) — Splinter Review
Two points:
1. <constructor action="..."> doesn't seem to work
2. this.boxObject.getProperty('value') doesn't seem to work
Attachment #107468 - Flags: superreview?(jaggernaut)
Attachment #107468 - Flags: review?(blaker)
Keywords: patch, polish, review
<constructor action="..."/> not working may or may not be by design. Ask hyatt.

this.boxObject.getProperty("...") should work (if that property was previously set).

What the old code did (assuming action="..." worked properly) was take the
current value and store it on the boxObject whenever the user switched skins
(when live skin switching was still supported). The XBL object itself would be
destructed, and a new one constructed, while the boxObject would stick around,
so the new XBL object could get the stored value and restore itself.

Since we dropped support for live skin switching, we might be able to just drop
that code, in which case your patch is fine as is if you remove the
<destructor>. If we want to keep support for it in our widgets, you need to do
something like:

<constructor>
  var value = this.boxObject.getProperty("value");
  if (value)
    this.boxObject.removeProperty("value");
  else
    value = this.getAttribute("value");

  if (value)
    this.inputField.value = value;
</constructor>

<destructor>
  var value = this.inputField.value;
  if (value)
    this.boxObject.setProperty("value", value);
</destructor>
As Neil pointed out, the above needs some kind of check for null vs. "" returned
from getProperty() to detect when a live skin switch is done if the user deleted
the textbox's value. Otherwise we'd pick up the initial value from the attribute.
Attached patch Better patchSplinter Review
Attachment #107468 - Attachment is obsolete: true
Comment on attachment 107474 [details] [diff] [review]
Better patch

Nice. sr=jag. Could you add a comment about why the empty <children/> is
needed, with a reference to the bug#?

Could you also file bugs on the action="" issue, and a bug on dealing with live
skin switching support on textboxes (either remove it, or fix it)?
Attachment #107474 - Flags: superreview+
Attachment #107474 - Flags: review?(blaker)
Attachment #107468 - Flags: superreview?(jaggernaut)
Attachment #107468 - Flags: review?(blaker)
retargeting
Target Milestone: mozilla1.0.1 → Future
Comment on attachment 107474 [details] [diff] [review]
Better patch

Neil is a peer now, can we get this checked in please? it seems really
low-risk.
Attachment #107474 - Flags: review?(blake)
Attachment #107474 - Flags: review+
Attachment #107474 - Flags: approval1.6b?
Assignee: hyatt → neil.parkwaycc.co.uk
Attachment #107474 - Flags: approval1.6b? → approval1.6b+
For 1.6b?

/be
Er, yeah, for 1.6b!  Who is checking in?

/be
I got this fixed for seamonkey, asked bryner for approval to land it into the
new toolkit as well.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Whiteboard: seamonkey FIXED, seeking approval for new toolkit
Target Milestone: Future → mozilla1.6beta
Re-attaching patch for firebird review.
Attachment #136862 - Flags: review?(bryner)
Comment on attachment 136862 [details] [diff] [review]
port patch to new toolkit

checked into toolkit/.
Attachment #136862 - Flags: review?(bryner) → review+
This seems to have caused textareas to contain whitespace by default, for
example,  when creating a new folder in Bookmark Manager the "Description" field
contains spaces. (in Moz 2004011508)
The XBL content sink now honours whitespace inside HTML tags, so we need to
close up the child tags.
Attachment #139289 - Flags: superreview?(hyatt)
Attachment #139289 - Flags: review?(hyatt)
Comment on attachment 139289 [details] [diff] [review]
Fix regression caused by xbl content sink change

sr=hyatt
Attachment #139289 - Flags: superreview?(hyatt) → superreview+
Attachment #139289 - Flags: review?(hyatt) → review+
Whiteboard: seamonkey FIXED, seeking approval for new toolkit
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: