XFOrms/XPath Parsing one data element into two controls for editing

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

XFOrms/XPath Parsing one data element into two controls for editing

Richard Braman
Message
I am going to take a bretther on my style/checkbox dillema and ask another question
 
suppose you have something like a phone number or a social security number that you want to sotre in one XML element, but you wnat to display to the user as two different inputs.
 
For example, a phone number can have two parts aread code and number.  This is what I tried to no avail.
 
<xforms:instance>
<form>
<1040ez>
    <!--users phone number-->
    <SEQ0010>5617484002</SEQ0010>
........
</xforms:instance>
 
<xforms:bind id="areacode" nodeset="substring(/form/f1040ez/SEQ0010,1,3)"></xforms:bind>
<xforms:bind id="number" nodeset="substring(/form/f1040ez/SEQ0010,4,7)"></xforms:bind>
<xforms:input  bind="areacode" >
<xforms:input  bind="number" >
 
When the user clicks save the sum of the two inputs should be saved into the users record under SEQ0010.
 
 
 
 
 
 
 

Richard Braman
[hidden email]
561.748.4002 (voice)

http://www.taxcodesoftware.org
Free Open Source Tax Software

 


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XFOrms/XPath Parsing one data element into two controls for editing

Adrian Baker-2
The nodeset attribute of a bind must resolve to a set of nodes, whereas the substring function returns a string.

So what this translates to is unfortunately you can't really do what you're attempting - select different parts of the same node over multiple binds. With some trickery it might be possible to present the same node twice in different ways, but you'd be limited to presentation only - you wouldn't be able to edit a single node in pieces like this.

How about separating your phone number into it's constituent parts in your xml:

<phonenumber>
  <areacode>9</areacode>
  <number>5204325</number>
</phonenumber>

Then you could bind to each part of the number easily enough. If you then need the phonenumber in a single node, you could combine the two using a calculated bind, or in an XSLT post-submission.

Adrian

Richard Braman wrote:
Message
I am going to take a bretther on my style/checkbox dillema and ask another question
 
suppose you have something like a phone number or a social security number that you want to sotre in one XML element, but you wnat to display to the user as two different inputs.
 
For example, a phone number can have two parts aread code and number.  This is what I tried to no avail.
 
<xforms:instance>
<form>
<1040ez>
    <!--users phone number-->
    <SEQ0010>5617484002</SEQ0010>
........
</xforms:instance>
 
<xforms:bind id="areacode" nodeset="substring(/form/f1040ez/SEQ0010,1,3)"></xforms:bind>
<xforms:bind id="number" nodeset="substring(/form/f1040ez/SEQ0010,4,7)"></xforms:bind>
<xforms:input  bind="areacode" >
<xforms:input  bind="number" >
 
When the user clicks save the sum of the two inputs should be saved into the users record under SEQ0010.
 
 
 
 
 
 
 

Richard Braman
[hidden email]
561.748.4002 (voice)

http://www.taxcodesoftware.org
Free Open Source Tax Software

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: XFOrms/XPath Parsing one data element into two controls for editing

Richard Braman
Message
Is it possible with ref=""
I cant seem to use refs and binds in the same xFORM.
I can't split it up in my instance, it is based on a the e-file schema defined by the IRS, they want it all in one field.
-----Original Message-----
From: Adrian Baker [mailto:[hidden email]]
Sent: Thursday, February 09, 2006 11:51 PM
To: [hidden email]
Subject: Re: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

The nodeset attribute of a bind must resolve to a set of nodes, whereas the substring function returns a string.

So what this translates to is unfortunately you can't really do what you're attempting - select different parts of the same node over multiple binds. With some trickery it might be possible to present the same node twice in different ways, but you'd be limited to presentation only - you wouldn't be able to edit a single node in pieces like this.

How about separating your phone number into it's constituent parts in your xml:

<phonenumber>
  <areacode>9</areacode>
  <number>5204325</number>
</phonenumber>

Then you could bind to each part of the number easily enough. If you then need the phonenumber in a single node, you could combine the two using a calculated bind, or in an XSLT post-submission.

Adrian

Richard Braman wrote:
I am going to take a bretther on my style/checkbox dillema and ask another question
 
suppose you have something like a phone number or a social security number that you want to sotre in one XML element, but you wnat to display to the user as two different inputs.
 
For example, a phone number can have two parts aread code and number.  This is what I tried to no avail.
 
<xforms:instance>
<form>
<1040ez>
    <!--users phone number-->
    <SEQ0010>5617484002</SEQ0010>
........
</xforms:instance>
 
<xforms:bind id="areacode" nodeset="substring(/form/f1040ez/SEQ0010,1,3)"></xforms:bind>
<xforms:bind id="number" nodeset="substring(/form/f1040ez/SEQ0010,4,7)"></xforms:bind>
<xforms:input  bind="areacode" >
<xforms:input  bind="number" >
 
When the user clicks save the sum of the two inputs should be saved into the users record under SEQ0010.
 
 
 
 
 
 
 

Richard Braman
[hidden email]
561.748.4002 (voice)

http://www.taxcodesoftware.org
Free Open Source Tax Software

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XFOrms/XPath Parsing one data element into two controls for editing

Adrian Baker-2
No, a ref still has to point to a single node (or set of nodes).

If you're dealing with an externally defined fixed schema, you can write a simple XSLT which takes the output of your form (phonenumber split out into separate elements) and transforms this into the required format (phonenumber as a single element).

Alternatively you can use a separate UI-instance which holds the split out phonenumber, then make the bind to your phonenumber in your submission instance a calculated bind which combines the two into a single string.

Either will work, but since you're dealing with a fixed schema and it sounds like you want a fair amount of control over your form, I'd suggest the first since I suspect there will be other discrepancies that will arise (empty versus not present or null elements especially), and the XSLT provides a single location to handle all of these - plus it leaves your xforms markup free from workarounds.

Adrian

Richard Braman wrote:
Message
Is it possible with ref=""
I cant seem to use refs and binds in the same xFORM.
I can't split it up in my instance, it is based on a the e-file schema defined by the IRS, they want it all in one field.
-----Original Message-----
From: Adrian Baker [[hidden email]]
Sent: Thursday, February 09, 2006 11:51 PM
To: [hidden email]
Subject: Re: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

The nodeset attribute of a bind must resolve to a set of nodes, whereas the substring function returns a string.

So what this translates to is unfortunately you can't really do what you're attempting - select different parts of the same node over multiple binds. With some trickery it might be possible to present the same node twice in different ways, but you'd be limited to presentation only - you wouldn't be able to edit a single node in pieces like this.

How about separating your phone number into it's constituent parts in your xml:

<phonenumber>
  <areacode>9</areacode>
  <number>5204325</number>
</phonenumber>

Then you could bind to each part of the number easily enough. If you then need the phonenumber in a single node, you could combine the two using a calculated bind, or in an XSLT post-submission.

Adrian

Richard Braman wrote:
I am going to take a bretther on my style/checkbox dillema and ask another question
 
suppose you have something like a phone number or a social security number that you want to sotre in one XML element, but you wnat to display to the user as two different inputs.
 
For example, a phone number can have two parts aread code and number.  This is what I tried to no avail.
 
<xforms:instance>
<form>
<1040ez>
    <!--users phone number-->
    <SEQ0010>5617484002</SEQ0010>
........
</xforms:instance>
 
<xforms:bind id="areacode" nodeset="substring(/form/f1040ez/SEQ0010,1,3)"></xforms:bind>
<xforms:bind id="number" nodeset="substring(/form/f1040ez/SEQ0010,4,7)"></xforms:bind>
<xforms:input  bind="areacode" >
<xforms:input  bind="number" >
 
When the user clicks save the sum of the two inputs should be saved into the users record under SEQ0010.
 




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: XFOrms/XPath Parsing one data element into two controls for editing

Richard Braman
Message
Sticking with your first suggestion:
 
>If you're dealing with an externally defined fixed schema, you can write a simple XSLT which takes the output of your form (phonenumber split out into separate >elements) and transforms this into the required format (phonenumber as a single element).
 
How about loading the saved instance back into the form?
-----Original Message-----
From: Adrian Baker [mailto:[hidden email]]
Sent: Friday, February 10, 2006 12:15 AM
To: [hidden email]
Subject: Re: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

No, a ref still has to point to a single node (or set of nodes).

If you're dealing with an externally defined fixed schema, you can write a simple XSLT which takes the output of your form (phonenumber split out into separate elements) and transforms this into the required format (phonenumber as a single element).

Alternatively you can use a separate UI-instance which holds the split out phonenumber, then make the bind to your phonenumber in your submission instance a calculated bind which combines the two into a single string.

Either will work, but since you're dealing with a fixed schema and it sounds like you want a fair amount of control over your form, I'd suggest the first since I suspect there will be other discrepancies that will arise (empty versus not present or null elements especially), and the XSLT provides a single location to handle all of these - plus it leaves your xforms markup free from workarounds.

Adrian

Richard Braman wrote:
Is it possible with ref=""
I cant seem to use refs and binds in the same xFORM.
I can't split it up in my instance, it is based on a the e-file schema defined by the IRS, they want it all in one field.
-----Original Message-----
From: Adrian Baker [[hidden email]]
Sent: Thursday, February 09, 2006 11:51 PM
To: [hidden email]
Subject: Re: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

The nodeset attribute of a bind must resolve to a set of nodes, whereas the substring function returns a string.

So what this translates to is unfortunately you can't really do what you're attempting - select different parts of the same node over multiple binds. With some trickery it might be possible to present the same node twice in different ways, but you'd be limited to presentation only - you wouldn't be able to edit a single node in pieces like this.

How about separating your phone number into it's constituent parts in your xml:

<phonenumber>
  <areacode>9</areacode>
  <number>5204325</number>
</phonenumber>

Then you could bind to each part of the number easily enough. If you then need the phonenumber in a single node, you could combine the two using a calculated bind, or in an XSLT post-submission.

Adrian

Richard Braman wrote:
I am going to take a bretther on my style/checkbox dillema and ask another question
 
suppose you have something like a phone number or a social security number that you want to sotre in one XML element, but you wnat to display to the user as two different inputs.
 
For example, a phone number can have two parts aread code and number.  This is what I tried to no avail.
 
<xforms:instance>
<form>
<1040ez>
    <!--users phone number-->
    <SEQ0010>5617484002</SEQ0010>
........
</xforms:instance>
 
<xforms:bind id="areacode" nodeset="substring(/form/f1040ez/SEQ0010,1,3)"></xforms:bind>
<xforms:bind id="number" nodeset="substring(/form/f1040ez/SEQ0010,4,7)"></xforms:bind>
<xforms:input  bind="areacode" >
<xforms:input  bind="number" >
 
When the user clicks save the sum of the two inputs should be saved into the users record under SEQ0010.
 




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: XFOrms/XPath Parsing one data element into two controls for editing

Greg Jones-2
In reply to this post by Richard Braman
Message

Another option here is to split the field into 2 when you load it into your XForms instance and then concatenate the 2 fields again when you store the information. The beauty of OPS pipelines and the XSLT processor!

 


From: Richard Braman [mailto:[hidden email]]
Sent: Friday, 10 February 2006 3:50 PM
To: [hidden email]
Subject: RE: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

 

Is it possible with ref=""

I cant seem to use refs and binds in the same xFORM.

I can't split it up in my instance, it is based on a the e-file schema defined by the IRS, they want it all in one field.

-----Original Message-----
From: Adrian Baker [mailto:[hidden email]]
Sent: Thursday, February 09, 2006 11:51 PM
To: [hidden email]
Subject: Re: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

The nodeset attribute of a bind must resolve to a set of nodes, whereas the substring function returns a string.

So what this translates to is unfortunately you can't really do what you're attempting - select different parts of the same node over multiple binds. With some trickery it might be possible to present the same node twice in different ways, but you'd be limited to presentation only - you wouldn't be able to edit a single node in pieces like this.

How about separating your phone number into it's constituent parts in your xml:

<phonenumber>
  <areacode>9</areacode>
  <number>5204325</number>
</phonenumber>

Then you could bind to each part of the number easily enough. If you then need the phonenumber in a single node, you could combine the two using a calculated bind, or in an XSLT post-submission.

Adrian

Richard Braman wrote:

I am going to take a bretther on my style/checkbox dillema and ask another question

 

suppose you have something like a phone number or a social security number that you want to sotre in one XML element, but you wnat to display to the user as two different inputs.

 

For example, a phone number can have two parts aread code and number.  This is what I tried to no avail.

 

<xforms:instance>

<form>

<1040ez>

    <!--users phone number-->

    <SEQ0010>5617484002</SEQ0010>

........

</xforms:instance>

 

<xforms:bind id="areacode" nodeset="substring(/form/f1040ez/SEQ0010,1,3)"></xforms:bind>

<xforms:bind id="number" nodeset="substring(/form/f1040ez/SEQ0010,4,7)"></xforms:bind>

<xforms:input  bind="areacode" >

<xforms:input  bind="number" >

 

When the user clicks save the sum of the two inputs should be saved into the users record under SEQ0010.

 

 

 

 

 

 

 

Richard Braman
[hidden email]
561.748.4002 (voice)

http://www.taxcodesoftware.org
Free Open Source Tax Software

 

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: XFOrms/XPath Parsing one data element into two controls for editing

Richard Braman
Greg,
 
How would you go about doing this?
 
Richard
-----Original Message-----
From: Greg Jones [mailto:[hidden email]]
Sent: Friday, February 10, 2006 12:17 AM
To: [hidden email]
Subject: RE: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

Another option here is to split the field into 2 when you load it into your XForms instance and then concatenate the 2 fields again when you store the information. The beauty of OPS pipelines and the XSLT processor!

 


From: Richard Braman [mailto:[hidden email]]
Sent: Friday, 10 February 2006 3:50 PM
To: [hidden email]
Subject: RE: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

 

Is it possible with ref=""

I cant seem to use refs and binds in the same xFORM.

I can't split it up in my instance, it is based on a the e-file schema defined by the IRS, they want it all in one field.

-----Original Message-----
From: Adrian Baker [mailto:[hidden email]]
Sent: Thursday, February 09, 2006 11:51 PM
To: [hidden email]
Subject: Re: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

The nodeset attribute of a bind must resolve to a set of nodes, whereas the substring function returns a string.

So what this translates to is unfortunately you can't really do what you're attempting - select different parts of the same node over multiple binds. With some trickery it might be possible to present the same node twice in different ways, but you'd be limited to presentation only - you wouldn't be able to edit a single node in pieces like this.

How about separating your phone number into it's constituent parts in your xml:

<phonenumber>
  <areacode>9</areacode>
  <number>5204325</number>
</phonenumber>

Then you could bind to each part of the number easily enough. If you then need the phonenumber in a single node, you could combine the two using a calculated bind, or in an XSLT post-submission.

Adrian

Richard Braman wrote:

I am going to take a bretther on my style/checkbox dillema and ask another question

 

suppose you have something like a phone number or a social security number that you want to sotre in one XML element, but you wnat to display to the user as two different inputs.

 

For example, a phone number can have two parts aread code and number.  This is what I tried to no avail.

 

<xforms:instance>

<form>

<1040ez>

    <!--users phone number-->

    <SEQ0010>5617484002</SEQ0010>

........

</xforms:instance>

 

<xforms:bind id="areacode" nodeset="substring(/form/f1040ez/SEQ0010,1,3)"></xforms:bind>

<xforms:bind id="number" nodeset="substring(/form/f1040ez/SEQ0010,4,7)"></xforms:bind>

<xforms:input  bind="areacode" >

<xforms:input  bind="number" >

 

When the user clicks save the sum of the two inputs should be saved into the users record under SEQ0010.

 

 

 

 

 

 

 

Richard Braman
[hidden email]
561.748.4002 (voice)

http://www.taxcodesoftware.org
Free Open Source Tax Software

 

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: XFOrms/XPath Parsing one data element into two controls for editing

Greg Jones-2
Richard,

In my current project (using OPS) I have done something like the following:

When loading the instance using an XPL file:

1. Get the data from the data source (e.g. web service, database). This will
result in something like:

    <data>
        <name>Fred Smith</name>
        <telephone>123-456789</telephone>
    </data>

2. Transform the data into my XForms instance:

   <p:processor name="oxf:xslt-2.0">
        <p:input name="data" href="#my-data"/>
        <p:input name="config">
            <form>
                <name><xsl:value-of select="data/name"/></name>
                <areacode><xsl:value-of
select="substring-before(data/telephone,'-')"/></areacode>
                <number><xsl:value-of
select="substring-after(data/telephone,'-')"/></number>
            </form>
        </p:input>
        <p:output name="data" ref="data"/>
    </p:processor>

This assumes that the output parameter called "data" is going to be your
XForms instance and that the original data read from your store was fed to
this processor on an input called "my-data".

You can then include this as the instance data for your XForms view.

In the action or submission where you save the data, you simply do the
reverse:

1. Transform the data from the XForms instance to your required format:

   <p:processor name="oxf:xslt-2.0">
        <p:input name="data" href="#xforms-data"/>
        <p:input name="config">
            <data>
                <name><xsl:value-of select="form/name"/></name>
                <telephone><xsl:value-of
select="form/areacode"/>-<xsl:value-of select="form/number"/></telephone>
            </data>
        </p:input>
        <p:output name="data" ref="data"/>
    </p:processor>

2. Store the data (on the "data" output) to your data source (e.g. web
service, database).

This is a very brief overview, without a complete example but you should be
able to take one of the standard OPS examples and quite easily perform a
conversion on the data after loading and before storing to give it a go.

Regards,
Greg J.
 
________________________________________
From: Richard Braman [mailto:[hidden email]]
Sent: Friday, 10 February 2006 4:28 PM
To: [hidden email]
Subject: RE: [ops-users] XFOrms/XPath Parsing one data element into two
controls for editing

Greg,
 
How would you go about doing this?
 
Richard
-----Original Message-----
From: Greg Jones [mailto:[hidden email]]
Sent: Friday, February 10, 2006 12:17 AM
To: [hidden email]
Subject: RE: [ops-users] XFOrms/XPath Parsing one data element into two
controls for editing
Another option here is to split the field into 2 when you load it into your
XForms instance and then concatenate the 2 fields again when you store the
information. The beauty of OPS pipelines and the XSLT processor!

________________________________________
From: Richard Braman [mailto:[hidden email]]
Sent: Friday, 10 February 2006 3:50 PM
To: [hidden email]
Subject: RE: [ops-users] XFOrms/XPath Parsing one data element into two
controls for editing

Is it possible with ref=""
I cant seem to use refs and binds in the same xFORM.
I can't split it up in my instance, it is based on a the e-file schema
defined by the IRS, they want it all in one field.
-----Original Message-----
From: Adrian Baker [mailto:[hidden email]]
Sent: Thursday, February 09, 2006 11:51 PM
To: [hidden email]
Subject: Re: [ops-users] XFOrms/XPath Parsing one data element into two
controls for editing
The nodeset attribute of a bind must resolve to a set of nodes, whereas the
substring function returns a string.

So what this translates to is unfortunately you can't really do what you're
attempting - select different parts of the same node over multiple binds.
With some trickery it might be possible to present the same node twice in
different ways, but you'd be limited to presentation only - you wouldn't be
able to edit a single node in pieces like this.

How about separating your phone number into it's constituent parts in your
xml:

<phonenumber>
  <areacode>9</areacode>
  <number>5204325</number>
</phonenumber>

Then you could bind to each part of the number easily enough. If you then
need the phonenumber in a single node, you could combine the two using a
calculated bind, or in an XSLT post-submission.

Adrian

Richard Braman wrote:
I am going to take a bretther on my style/checkbox dillema and ask another
question
 
suppose you have something like a phone number or a social security number
that you want to sotre in one XML element, but you wnat to display to the
user as two different inputs.
 
For example, a phone number can have two parts aread code and number.  This
is what I tried to no avail.
 
<xforms:instance>
<form>
<1040ez>
    <!--users phone number-->
    <SEQ0010>5617484002</SEQ0010>
........
</xforms:instance>
 
<xforms:bind id="areacode"
nodeset="substring(/form/f1040ez/SEQ0010,1,3)"></xforms:bind>
<xforms:bind id="number"
nodeset="substring(/form/f1040ez/SEQ0010,4,7)"></xforms:bind>
<xforms:input  bind="areacode" >
<xforms:input  bind="number" >
 
When the user clicks save the sum of the two inputs should be saved into the
users record under SEQ0010.
 
 
 
 
 
 
 
Richard Braman
mailto:[hidden email]
561.748.4002 (voice)
http://www.taxcodesoftware.org
Free Open Source Tax Software
 




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: XFOrms/XPath Parsing one data element into two controls for editing

Richard Braman
In reply to this post by Adrian Baker-2
Message
Erik, can you comment on this.  I should not be that hard to split a datapoint into two editing controls.  This would normally require two lines of code in a standard web application.  Why is this so hard with XForms?
 
 
-----Original Message-----
From: Adrian Baker [mailto:[hidden email]]
Sent: Friday, February 10, 2006 12:15 AM
To: [hidden email]
Subject: Re: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

No, a ref still has to point to a single node (or set of nodes).

If you're dealing with an externally defined fixed schema, you can write a simple XSLT which takes the output of your form (phonenumber split out into separate elements) and transforms this into the required format (phonenumber as a single element).

Alternatively you can use a separate UI-instance which holds the split out phonenumber, then make the bind to your phonenumber in your submission instance a calculated bind which combines the two into a single string.

Either will work, but since you're dealing with a fixed schema and it sounds like you want a fair amount of control over your form, I'd suggest the first since I suspect there will be other discrepancies that will arise (empty versus not present or null elements especially), and the XSLT provides a single location to handle all of these - plus it leaves your xforms markup free from workarounds.

Adrian

Richard Braman wrote:
Is it possible with ref=""
I cant seem to use refs and binds in the same xFORM.
I can't split it up in my instance, it is based on a the e-file schema defined by the IRS, they want it all in one field.
-----Original Message-----
From: Adrian Baker [[hidden email]]
Sent: Thursday, February 09, 2006 11:51 PM
To: [hidden email]
Subject: Re: [ops-users] XFOrms/XPath Parsing one data element into two controls for editing

The nodeset attribute of a bind must resolve to a set of nodes, whereas the substring function returns a string.

So what this translates to is unfortunately you can't really do what you're attempting - select different parts of the same node over multiple binds. With some trickery it might be possible to present the same node twice in different ways, but you'd be limited to presentation only - you wouldn't be able to edit a single node in pieces like this.

How about separating your phone number into it's constituent parts in your xml:

<phonenumber>
  <areacode>9</areacode>
  <number>5204325</number>
</phonenumber>

Then you could bind to each part of the number easily enough. If you then need the phonenumber in a single node, you could combine the two using a calculated bind, or in an XSLT post-submission.

Adrian

Richard Braman wrote:
I am going to take a bretther on my style/checkbox dillema and ask another question
 
suppose you have something like a phone number or a social security number that you want to sotre in one XML element, but you wnat to display to the user as two different inputs.
 
For example, a phone number can have two parts aread code and number.  This is what I tried to no avail.
 
<xforms:instance>
<form>
<1040ez>
    <!--users phone number-->
    <SEQ0010>5617484002</SEQ0010>
........
</xforms:instance>
 
<xforms:bind id="areacode" nodeset="substring(/form/f1040ez/SEQ0010,1,3)"></xforms:bind>
<xforms:bind id="number" nodeset="substring(/form/f1040ez/SEQ0010,4,7)"></xforms:bind>
<xforms:input  bind="areacode" >
<xforms:input  bind="number" >
 
When the user clicks save the sum of the two inputs should be saved into the users record under SEQ0010.
 




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XFOrms/XPath Parsing one data element into two controls for editing

Erik Bruchez
Administrator
Richard Braman wrote:
 > Erik, can you comment on this.  I should not be that hard to split a
 > datapoint into two editing controls.

With XForms, a control binds to a node, whether attribute, element, or
text. So if you have one such node somewhere in your instance, and you
want two controls, I don't see a way besides splitting that node into
two.

I believe the real solution you are looking for is not necessarily
splitting, but input masks. These are currently not a feature of
XForms, but certainly they would be very valuable as an extension.

Without such input masks, you will have to do some splitting and
reassembling of the data, whether in XSLT or XForms.

 > This would normally require two lines of code in a standard web
 > application.

Beyond input masks, I doubt it, but if you have examples, maybe they
can inspire improvements in XForms?

-Erik




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws