W3C home > Mailing lists > Public > www-forms@w3.org > February 2014

Re: Get the values of an element and combine them

From: John Boyer <boyerj@ca.ibm.com>
Date: Mon, 24 Feb 2014 10:10:10 -0800
To: "Steven Pemberton" <Steven.Pemberton@cwi.nl>
Cc: "Jean-Baptiste Pressac" <Jean-Baptiste.Pressac@univ-brest.fr>, public-xformsusers@w3.org, www-forms@w3.org
Message-ID: <OF56E0D1B7.E043EB82-ON88257C89.0062FFCA-88257C89.0063D028@ca.ibm.com>
A couple of minor points:

1) It's typically better to use xforms-model-construct-done so that the 
data values are available to the UI when it is first created, rather than 
having any kind of value change.

2) The reason I don't usually push this approach is that, you're right, it 
doesn't account for many use cases in the lifecycle of the data.  For 
example:
- If a new result is obtained from a REST or web service by an xforms 
submission, then the xforms submit done must also do the same copy 
operations
- Similar issue if someone does a setvalue on the spatial datum, they must 
do parallel setvalue operations on the instance data
- Schema validity results for the spatial datum do not transfer to the 
controls bound to temporary instance data into which copies have been 
made.
- Model item properties like readonly, required, constraint placed on the 
spatial datum do not transfer, and so must be recoded as more binds
- If this construct is within a repeat, then all of these special cases 
have increased complexity in light of row insertions

Cheers,
John M. Boyer, Ph.D.
IBM Distinguished Engineer & IBM Master Inventor
@johnboyerphd | boyerj@ca.ibm.com




From:   "Steven Pemberton" <Steven.Pemberton@cwi.nl>
To:     public-xformsusers@w3.org, www-forms@w3.org, "Jean-Baptiste 
Pressac" <Jean-Baptiste.Pressac@univ-brest.fr>, 
Date:   02/24/2014 08:55 AM
Subject:        Re: Get the values of an element and combine them



Here is an example of how I would do it:

                 http://www.cwi.nl/~steven/forms/dcterms.xml

I'm not sure of all the requirements of your problem, but what I do is:

                 1. At initialisation, extract the values of east and 
north from your 
input spatial value:

                     <action ev:event="xforms-ready">
                                 <setvalue ref="east" 
value="substring-before(substring-after(instance('in')/spatial, 'east='), 
';')"/>
                                 <setvalue ref="north" 
value="substring-before(substring-after(instance('in')/spatial, 'north='), 
 
';')"/>
                     </action>

                 2. Bind a calculation to the output spatial value:

                     <bind ref="spatial" calculate="concat('east=', 
../east, '; north=', 
../north, ';')"/>

I hope this helps.

Steven Pemberton

On Thu, 20 Feb 2014 16:13:50 +0100, Jean-Baptiste Pressac 
<Jean-Baptiste.Pressac@univ-brest.fr> wrote:

> Hello,
> I would like to use Xform to edit the following element :
> <dcterms:spatial xsi:type="dcterms:Point">east=456;
> north=123;</dcterms:spatial>
>
> I could use :
> <xf:input ref="dcterms:spatial[@xsi:type='dcterms:Point']"
> class="dcterms:spatial">
>      <xf:label>Latitude / Longitude:</xf:label>
> </xf:input>
>
> But is there a way to display two inputs to let the user enter the east
> value and the north value separately ?
>
> Thanks,
Received on Monday, 24 February 2014 18:10:46 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:26 UTC