elements with xsi:type are not validated on form load

RESOLVED FIXED

Status

Core Graveyard
XForms
P1
normal
RESOLVED FIXED
11 years ago
9 months ago

People

(Reporter: Allan Beaufour, Assigned: Allan Beaufour)

Tracking

({fixed1.8.0.5, fixed1.8.1})

Trunk
fixed1.8.0.5, fixed1.8.1

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(2 attachments, 1 obsolete attachment)

3.24 KB, application/xhtml+xml
Details
1.07 KB, patch
Doron Rosenberg (IBM)
: review+
aaronr
: review+
Details | Diff | Splinter Review
(Assignee)

Description

11 years ago
We do not seem to validate elements with types set directly by xsi:type on form load.
(Assignee)

Comment 1

11 years ago
Created attachment 217273 [details]
Testcase
(Assignee)

Updated

11 years ago
Priority: -- → P1
(Assignee)

Updated

11 years ago
Blocks: 331209

Comment 2

11 years ago
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

11 years ago
Or maybe in when an instance is through loading it should mark every node it contains as dirty?
(Assignee)

Comment 4

11 years ago
(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?
(Assignee)

Comment 5

11 years ago
(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
(Assignee)

Updated

11 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 6

11 years ago
Created attachment 222859 [details]
Revised testcase

Use xsd:date instead of custom type, and add inline schema attached type too
Attachment #217273 - Attachment is obsolete: true
(Assignee)

Comment 7

11 years ago
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.
Attachment #222864 - Flags: review?(doronr)

Updated

11 years ago
Attachment #222864 - Flags: review?(doronr) → review+
(Assignee)

Updated

11 years ago
Attachment #222864 - Flags: review?(aaronr)

Updated

11 years ago
Attachment #222864 - Flags: review?(aaronr) → review+
(Assignee)

Comment 8

11 years ago
Fixed on trunk
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
(Assignee)

Updated

11 years ago
Keywords: fixed1.8.1
(Assignee)

Updated

11 years ago
Keywords: fixed1.8.0.5
(Assignee)

Updated

11 years ago
Whiteboard: xf-to-branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.