Last Comment Bug 332803 - elements with xsi:type are not validated on form load
: elements with xsi:type are not validated on form load
Status: RESOLVED FIXED
: fixed1.8.0.5, fixed1.8.1
Product: Core Graveyard
Classification: Graveyard
Component: XForms (show other bugs)
: Trunk
: All All
: P1 normal (vote)
: ---
Assigned To: Allan Beaufour
: Stephen Pride
:
Mentors:
http://www.w3.org/TR/xforms/
Depends on:
Blocks: 331209
  Show dependency treegraph
 
Reported: 2006-04-05 03:17 PDT by Allan Beaufour
Modified: 2016-07-15 14:46 PDT (History)
3 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Testcase (2.53 KB, application/xhtml+xml)
2006-04-05 03:18 PDT, Allan Beaufour
no flags Details
Revised testcase (3.24 KB, application/xhtml+xml)
2006-05-22 07:15 PDT, Allan Beaufour
no flags Details
Patch (1.07 KB, patch)
2006-05-22 07:42 PDT, Allan Beaufour
doronr: review+
aaronr: review+
Details | Diff | Splinter Review

Description Allan Beaufour 2006-04-05 03:17:46 PDT
We do not seem to validate elements with types set directly by xsi:type on form load.
Comment 1 Allan Beaufour 2006-04-05 03:18:56 PDT
Created attachment 217273 [details]
Testcase
Comment 2 aaronr 2006-04-29 19:23:23 PDT
The problem here is that during initialization an instance node won't be inserted into the MDG unless it is bound via a xf:bind.  So when we rebuild, recalculate and revalidate during form initialization, the nodes that are bound via @ref and have xsi:type on them won't be in the MDG, won't be picked up by recalculate and thus won't be validated by revalidate.  In the testcase when the node value is changed to another invalid value, it will correctly display as invalid because SetValue will mark the node as changed and thus it will go into the MDG to be picked up by recalculate and then used by revalidate which will call ValidateNode on it.

I don't know what the right answer is, though.  Maybe ValidateDocument should return a list of invalid nodes and we should then mark all of the controls bound to those nodes as invalid?
Comment 3 aaronr 2006-05-01 13:37:42 PDT
Or maybe in when an instance is through loading it should mark every node it contains as dirty?
Comment 4 Allan Beaufour 2006-05-04 06:58:04 PDT
(In reply to comment #2)
> I don't know what the right answer is, though.  Maybe ValidateDocument should
> return a list of invalid nodes and we should then mark all of the controls
> bound to those nodes as invalid?

Afaik, ValidateDocument() just bails when it finds something which is not valid, does it not?

(In reply to comment #3)
> Or maybe in when an instance is through loading it should mark every node it
> contains as dirty?

That would add every instance data node to the MDG or to the list :(

I've never been really keen on our (my) type handling, but it does make sure that we only check types for nodes that change value -- which is nice :)

Maybe we should just make sure that all instance data nodes that have controls bound to them exist in the MDG?
Comment 5 Allan Beaufour 2006-05-17 05:20:07 PDT
(In reply to comment #4)
> Maybe we should just make sure that all instance data nodes that have controls
> bound to them exist in the MDG?

Best plan so far, I'll chew on it.

Comment 6 Allan Beaufour 2006-05-22 07:15:58 PDT
Created attachment 222859 [details]
Revised testcase

Use xsd:date instead of custom type, and add inline schema attached type too
Comment 7 Allan Beaufour 2006-05-22 07:42:35 PDT
Created attachment 222864 [details] [diff] [review]
Patch

Every time the MDG creates a new node, it will type check it. This only happens one time (per rebuild), which is the first time a node is accessed by a control.
Comment 8 Allan Beaufour 2006-05-23 01:23:23 PDT
Fixed on trunk

Note You need to log in before you can comment on or make changes to this bug.