Closed Bug 332803 Opened 18 years ago Closed 18 years ago

elements with xsi:type are not validated on form load

Categories

(Core Graveyard :: XForms, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: allan, Assigned: allan)

References

()

Details

(Keywords: fixed1.8.0.5, fixed1.8.1)

Attachments

(2 files, 1 obsolete file)

3.24 KB, application/xhtml+xml
Details
1.07 KB, patch
doronr
: review+
aaronr
: review+
Details | Diff | Splinter Review
We do not seem to validate elements with types set directly by xsi:type on form load.
Attached file Testcase (obsolete) —
Priority: -- → P1
Blocks: 331209
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?
Or maybe in when an instance is through loading it should mark every node it contains as dirty?
(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?
(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.

Assignee: aaronr → allan
Status: NEW → ASSIGNED
Attached file Revised testcase
Use xsd:date instead of custom type, and add inline schema attached type too
Attachment #217273 - Attachment is obsolete: true
Attached patch PatchSplinter Review
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.
Attachment #222864 - Flags: review?(doronr)
Attachment #222864 - Flags: review?(doronr) → review+
Attachment #222864 - Flags: review?(aaronr)
Attachment #222864 - Flags: review?(aaronr) → review+
Fixed on trunk
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
Keywords: fixed1.8.1
Keywords: fixed1.8.0.5
Whiteboard: xf-to-branch
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: