[
http://issues.apache.org/jira/browse/COCOON-1863?page=comments#action_12416469
]
Feliciano Borrego commented on COCOON-1863:
-------------------------------------------
In the Cocoon example "form2xml.flow", submiting the form with the field
"Please enter your IP address" empty,
the form.save() function:
function form2xml(form) {
[...]
// bind the form's data back to the document
form.save(document);
saveDocument(document, makeTargetURI(documentURI));
cocoon.sendPage("form2-success-pipeline");
}
in Cocoon 2.1.9/2.1.10-dev makes a "document" that does not contain the node
<ipaddress></ipaddress> corresponding to this form field.
However in Cocoon 2.1.8, the Xml contains the empty node <ipaddress changed= "
true" />
In my application:
=============
* Flow.js --------------------------
function form2xml(form) {
[...]
// bind the form's data back to the document
form.save(document);
cocoon.sendPage( "frm-success-pipeline", { "htmldata" : document } );
}
* sitemap.xmap ------------
<map:match pattern="frm-success-pipeline">
<map:generate type="jx"
src="portal/forms/resources/formModel2xml.jx"/>
<map:serialize type="xml"/>
</map:match>
*formModel2xml.jx --------------------
<?xml version="1.0"?>
<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
<result>#{htmldata}</result>
</jx:template>
In Cocoon 2.1.8, the XML contains ALL nodes of the form model. In a XSP, the
jpath expression <jpath:value-of select="field" /> return an empty string, not
a null (or exception with set-lenient lenient="false").
The Xml tree created by Cocoon 2.1.9+ not contains any empty node, the empty
nodes corresponding to empty form fields are eliminated.
> Save form model with empty fields: Binding model to document fails
> ------------------------------------------------------------------
>
> Key: COCOON-1863
> URL: http://issues.apache.org/jira/browse/COCOON-1863
> Project: Cocoon
> Type: Bug
> Components: Blocks: Forms
> Versions: 2.1.9
> Reporter: Feliciano Borrego
>
> In the Cocoon example "samples/blocks/forms/form2xml.flow",
> when submit the form with the fields "IP adress", "phone number" and all
> "contacts" fields empty,
> in Cocoon 2.1.8 the XML is:
> <data>
> <wrapper>
> <context>
> <info>
> <email boolBindingWorks="false">[EMAIL PROTECTED]</email>
> <number value="3"/>
> <choose value="true"/>
> <phone cntr="">
> <zone/>
> <number/>
> </phone>
> </info>
> <ipaddress changed="true"/>
> <birthday>1960-04-10</birthday>
> <drinks>
> <drink>Jupiler</drink><drink>Hoegaarden</drink></drinks>
> <contacts>
> <contact id="1" row-state="original">
> <firstname/>
> <lastname/>
> <phone nr=""/>
> <email/>
> </contact>
> <contact id="2" row-state="original">
> <firstname/>
> <lastname/>
> <phone nr=""/>
> <email/>
> </contact>
> </contacts>
> </context>
> </wrapper>
> </data>
> Therefore in Cocoon 2.1.9 the XML result is:
> <data>
> <wrapper>
> <context>
> <info>
> <email boolBindingWorks="false">[EMAIL PROTECTED]</email>
> <number value="3"/>
> <choose value="false"/>
> <phone>
> </phone>
> </info>
> <birthday>1960-04-10</birthday>
> <drinks>
> <drink>Jupiler</drink><drink>Leffe</drink></drinks>
> <contacts>
> <contact id="1" row-state="original">
> <phone/>
> </contact>
> <contact id="2" row-state="original">
> <phone/>
> </contact>
> </contacts>
> </context>
> </wrapper>
> </data>
> The "Simple XML Binding " and "Bean Binding" examples works fine.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira