Closed Bug 300243 Opened 19 years ago Closed 19 years ago

upload doesn't generate xforms-value-changed event

Categories

(Core Graveyard :: XForms, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aaronr, Assigned: aaronr)

Details

Attachments

(2 files, 1 obsolete file)

the upload control doesn't make the model recalculate, revalidate or refresh
after it updates the bound node.  So controls also bound to the instance data
don't refresh with the new value and xforms-value-changed event isn't fired.
Attached file testcase
changing the value of the upload filename field and then tabbing should change
the value of the output field and generate a xforms-value-changed message
Attached patch proposed fix (obsolete) — Splinter Review
just added the appropriate checks to make sure that the node value actually got
changed and then dispatched the events for recalc, etc.  Once upload is
xbl-ized, this will need to be done in ::SetValue instead of ::Blur.  Just like
in nsXFormsInputElement.cpp.  But this will work just dandy for now.
Attachment #188818 - Flags: review?(smaug)
Status: NEW → ASSIGNED
(In reply to comment #2)
> Created an attachment (id=188818) [edit]
> proposed fix
> 

In Linux I get the xforms-value-changed message and the <output> shows that the
value is file:// when I first time click the |browse...| button.
Then I get the event second time when actually selecting some file. 

On the second time I don't see the extra xforms-value-changed event 
when clicking |browse...|, apparently because the upload already has a value -
i.e. xforms-value-changed does work properly this time.

(In reply to comment #3)
> (In reply to comment #2)
> > Created an attachment (id=188818) [edit] [edit]
> > proposed fix
> > 
> 
> In Linux I get the xforms-value-changed message and the <output> shows that the
> value is file:// when I first time click the |browse...| button.
> Then I get the event second time when actually selecting some file. 
> 
> On the second time I don't see the extra xforms-value-changed event 
> when clicking |browse...|, apparently because the upload already has a value -
> i.e. xforms-value-changed does work properly this time.
> 
> 

Thanks for catching this smaug!  

I don't think that I see the problem as you describe it, but I recreated it
another way.  If I click on browse and then cancel it without changing anything
(so that the input field is still blank) and then tab, then I see the output
update with "file:///" and get the xforms-value-changed event.

The problem is that in nsXFormsUpdateElement::Blur(), we get the value from the
input field and then call NS_GetURLSpecFromFile and then I set the boundNode to
have this value and the MDG comes back and says whether this is a change or not.
 If it is a change, then I'll send out the proper recalculate, revalidate and
refresh events.  Well, the problem with this logic is that if the input field is
initially blank and we call NS_GetURLSpecFromFile, it will still return us
"file:///".  So if we go ahead and set the bound node to have this value, then
of course the MDG will tell me that the value has changed.  Doh!

I'll update my patch.
Attachment #188818 - Flags: review?(smaug)
Attached patch second trySplinter Review
fixed bug noticed by smaug.  Also noticed a couple of console errors that were
happening in ::Refresh when mBoundNode hadn't been set, yet, so fixed them up.
Attachment #188818 - Attachment is obsolete: true
Attachment #189985 - Flags: review?(smaug)
Attachment #189985 - Flags: review?(smaug) → review+
Attachment #189985 - Flags: review?(doronr)
Attachment #189985 - Flags: review?(doronr) → review+
doron, could you please check it in for me?
checked in
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: