Discussion:
Calculated submissions
Mark Lawson
2014-08-13 15:05:52 UTC
Permalink
Hi,

I’ve got an issue with calculated submissions using <xf:resource/> in 1.0RC2

I’ve got a control instance with a case element. This gets set in a select1 to what case I want.
I’ve a submission to get this case and put the results in the case_record instance:


<!— Instance to hold the case —>
<xf:instance id="case_record" xmlns="">
<data></data>
</xf:instance>

<!— Instance to control bits of the form —>
<xf:instance id=“control" xmlns="">
<data>
<case>A100000</case>
<qstatus>OK</qstatus>
</data>
</xf:instance>

<xf:submission id="getcase"
method="get" replace="instance" instance="case_record"
omit-xml-declaration="yes" >
<xf:resource value="concat('v1/documents?uri=/cases/',instance(‘control')/case,'/case.xml')"/>
</xf:submission>

If I run this it works the first time, however the second time, it sends the calculated uri, *plus* every element now in the case_record (actually what ever is the first instance in the form). I can get around that, by creating a dummy instance at the top of my form that’s empty, i.e. <xf:instance><data/></xf:instance> but that seems a little messy.

I’ve also found that adding an action attribute with the base of my uri works as well:

<xf:submission id="getcase" action="v1/documents"
method="get" replace="instance" instance="case_record"
omit-xml-declaration="yes" >
<xf:resource value="concat('v1/documents?uri=/cases/',instance(‘control')/case,'/case.xml')"/>
</xf:submission>

My question should I be able to create a submission with just a <xf:resource> in it, without a ref/action/resource attribute?

Thanks,

Mark Lawson
Senior Technical Architect
Staffordshire and West Midlands
Community Rehabilitation Company
mark.lawson-5rH1pj4M5YNNG18e360bz2jD/***@public.gmane.org
[sent from home email]



------------------------------------------------------------------------------
a***@public.gmane.org
2014-08-20 20:00:23 UTC
Permalink
Hello Mark!

Sorry for the delay.

As specified at http://www.w3.org/TR/2009/REC-xforms-20091020/#submit-get, the
default instance is always serialized as application/x-www-form-urlencoded
unless the serialization attribute is set to "none".

Thank you for your feedback!

--Alain
Hi,
I’ve got an issue with calculated submissions using <xf:resource/> in 1.0RC2
I’ve got a control instance with a case element. This gets set in a select1 to
what case I want.
I’ve a submission to get this case and put the results in the case_record
<!— Instance to hold the case —>
<xf:instance id="case_record" xmlns="">
<data></data>
</xf:instance>
<!— Instance to control bits of the form —>
<xf:instance id=“control" xmlns="">
<data>
<case>A100000</case>
<qstatus>OK</qstatus>
</data>
</xf:instance>
<xf:submission id="getcase"
method="get" replace="instance" instance="case_record"
omit-xml-declaration="yes" >
<xf:resource
value="concat('v1/documents?uri=/cases/',instance(‘control')/case,'/case.xml')"/>
</xf:submission>
If I run this it works the first time, however the second time, it sends the
calculated uri, *plus* every element now in the case_record (actually what
ever is the first instance in the form). I can get around that, by creating a
dummy instance at the top of my form that’s empty, i.e.
<xf:instance><data/></xf:instance> but that seems a little messy.
I’ve also found that adding an action attribute with the base of my uri works
<xf:submission id="getcase" action="v1/documents"
method="get" replace="instance" instance="case_record"
omit-xml-declaration="yes" >
<xf:resource
value="concat('v1/documents?uri=/cases/',instance(‘control')/case,'/case.xml')"/>
</xf:submission>
My question should I be able to create a submission with just a <xf:resource>
in it, without a ref/action/resource attribute?
Thanks,
Mark Lawson
Senior Technical Architect
Staffordshire and West Midlands
Community Rehabilitation Company
[sent from home email]
------------------------------------------------------------------------------
_______________________________________________
Xsltforms-support mailing list
https://lists.sourceforge.net/lists/listinfo/xsltforms-support
Loading...