[1.1] Add @validate on submission element

RESOLVED FIXED

Status

Core Graveyard
XForms
--
enhancement
RESOLVED FIXED
10 years ago
10 months ago

People

(Reporter: Steve Speicher, Assigned: Steve Speicher)

Tracking

({fixed1.8.0.12, fixed1.8.1.4})

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Build Identifier: 

Currently in XForms 1.0 submissions are blocked due to data being invalid.

In 1.1 it is possible to disable this behavior by using:
  <submission validate="false" ... />


Reproducible: Always
(Assignee)

Comment 1

10 years ago
Created attachment 261389 [details]
test case
(Assignee)

Comment 2

10 years ago
See bug 278762 that is intended to put explicit ValidateDocument() call in.  Currently submission will fail if there is node marked invalid (where a check will need to be made for the new @validate)
(Assignee)

Comment 3

10 years ago
Created attachment 261467 [details] [diff] [review]
patch

I don't put out any validation warning messages when @validate=false.  I assume that is what would be desired.
Attachment #261467 - Flags: review?(aaronr)

Comment 4

10 years ago
Comment on attachment 261467 [details] [diff] [review]
patch

>Index: nsXFormsSubmissionElement.cpp
>===================================================================

>@@ -1428,20 +1433,23 @@ nsXFormsSubmissionElement::CopyChildren(
>          *  SUBMIT_SKIP_NODE        - node is not to be serialized
>          *  SUBMIT_ABORT_SUBMISSION - abort submission (invalid node or empty required node)
>          */
>         if (handleNodeResult == nsIModelElementPrivate::SUBMIT_SKIP_NODE) {
>           // skip node and subtree
>           currentNode->GetNextSibling(getter_AddRefs(node));
>           currentNode.swap(node);
>           continue;
>-        } else if (handleNodeResult == nsIModelElementPrivate::SUBMIT_ABORT_SUBMISSION) {
>+        } else if (validate &&
>+                   handleNodeResult ==
>+                     nsIModelElementPrivate::SUBMIT_ABORT_SUBMISSION) {
>           // abort
>           nsXFormsUtils::ReportError(NS_LITERAL_STRING("warnSubmitInvalidNode"),
>                                      currentNode, nsIScriptError::warningFlag);
>+
>           return NS_ERROR_ILLEGAL_VALUE;
>         }

nit: please add a comment here spelling out that if validate is false we won't worry about  HandleInstanceDataNode returning  SUBMIT_ABORT_SUBMISSION for required but empty nodes or nodes that are invalid.  And that we assume that these are the only cases where HandleInstanceDataNode CAN return SUBMIT_ABORT_SUBMISSION.

with that, r=me
Attachment #261467 - Flags: review?(aaronr) → review+
(Assignee)

Comment 5

10 years ago
Created attachment 261676 [details] [diff] [review]
patch with Aaron's requested comment added
Attachment #261467 - Attachment is obsolete: true
Attachment #261676 - Flags: review?
(Assignee)

Updated

10 years ago
Attachment #261676 - Flags: review? → review?(Olli.Pettay)

Updated

10 years ago
Attachment #261676 - Flags: review?(Olli.Pettay) → review+

Updated

10 years ago
Assignee: xforms → sspeiche
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 6

10 years ago
checked into trunk for sspeiche
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch-11

Comment 7

10 years ago
checked into 1.8 and 1.8.0 branches
Keywords: fixed1.8.0.12, fixed1.8.1.4
Whiteboard: xf-to-branch-11
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.