Last Comment Bug 377298 - [1.1] Add @validate on submission element
: [1.1] Add @validate on submission element
Status: RESOLVED FIXED
: fixed1.8.0.12, fixed1.8.1.4
Product: Core
Classification: Components
Component: XForms (show other bugs)
: unspecified
: All All
: -- enhancement (vote)
: ---
Assigned To: Steve Speicher
: Stephen Pride
Mentors:
http://www.w3.org/TR/2007/WD-xforms11...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-12 09:11 PDT by Steve Speicher
Modified: 2007-04-24 19:11 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
test case (1.56 KB, application/xhtml+xml)
2007-04-12 09:13 PDT, Steve Speicher
no flags Details
patch (3.38 KB, patch)
2007-04-13 07:14 PDT, Steve Speicher
aaronr: review+
Details | Diff | Review
patch with Aaron's requested comment added (3.35 KB, patch)
2007-04-16 07:16 PDT, Steve Speicher
bugs: review+
Details | Diff | Review

Description Steve Speicher 2007-04-12 09:11:35 PDT
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
Comment 1 Steve Speicher 2007-04-12 09:13:13 PDT
Created attachment 261389 [details]
test case
Comment 2 Steve Speicher 2007-04-12 09:16:51 PDT
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)
Comment 3 Steve Speicher 2007-04-13 07:14:55 PDT
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.
Comment 4 aaronr 2007-04-13 12:14:32 PDT
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
Comment 5 Steve Speicher 2007-04-16 07:16:56 PDT
Created attachment 261676 [details] [diff] [review]
patch with Aaron's requested comment added
Comment 6 aaronr 2007-04-18 12:19:40 PDT
checked into trunk for sspeiche
Comment 7 aaronr 2007-04-24 19:11:23 PDT
checked into 1.8 and 1.8.0 branches

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