Closed Bug 377298 Opened 17 years ago Closed 17 years ago

[1.1] Add @validate on submission element

Categories

(Core Graveyard :: XForms, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sspeiche, Assigned: sspeiche)

References

()

Details

(Keywords: fixed1.8.0.12, fixed1.8.1.4)

Attachments

(2 files, 1 obsolete file)

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
Attached file test case
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)
Attached patch patch (obsolete) — Splinter Review
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 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+
Attachment #261467 - Attachment is obsolete: true
Attachment #261676 - Flags: review?
Attachment #261676 - Flags: review? → review?(Olli.Pettay)
Attachment #261676 - Flags: review?(Olli.Pettay) → review+
Assignee: xforms → sspeiche
Status: UNCONFIRMED → NEW
Ever confirmed: true
checked into trunk for sspeiche
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch-11
checked into 1.8 and 1.8.0 branches
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.

Attachment

General

Creator:
Created:
Updated:
Size: