W3C home > Mailing lists > Public > www-forms@w3.org > August 2010

Re: data export for subsequent transformation to csv

From: Aaron Reed <aaronr@us.ibm.com>
Date: Fri, 13 Aug 2010 13:00:09 -0500
To: www-forms@w3.org
Message-ID: <i441ae$b6n$1@dough.gmane.org>
Hi René,

If you put a ref attribute on a control and it doesn't show up in the 
form, then the odds are the xpath expression you used was incorrect. 
Binding a form control to a non-existent node implies that the control 
is not relevant and the default behavior in the Firefox xforms processor 
is to hide non-relevant controls.  Please try the example that Leigh 
posted.  It works fine for me in Firefox 3.6.8 using the mozilla xforms 
extension v0.8.7.

I also think you might be well served to perhaps read some xforms 
introductory information like: 
http://www.w3.org/MarkUp/Forms/2003/xforms-for-html-authors.html or 
perhaps http://en.wikibooks.org/wiki/XForms.  When you mentioned setting 
the namespace of the node to 'generalinformation' and then trying to use 
ref='generalinformation', it makes me think that perhaps you've missed 
some key concepts about xforms.  For example, the values of @bind and 
@ref (and other xforms attributes) should be xpath expressions, not 
namespace strings.  Hopefully reading the above information will get you 
on the right track.  If you still have problems, please let us know.


e-letter wrote:
> On 12/08/2010, Leigh L Klotz Jr<leigh.klotz@xerox.com>  wrote:
>> I hope this message reaches you as your email address doesn't seem accurate, but perhaps you'll see it on the list.
> I looked at the mail archive but could not see any messages for this month?
>> There are a couple of issues with your form:
>> 1. The instance should start out with elements for all the elements you want in the result.  In general, XForms form controls only change the text values of elements and attributes, and don't add them.  (There are a few cases where they do get added by controls and actions, but in the case of your form, they don't.)
> Referring to the w3 document 'xforms11', an example model element is produced:
> <xforms:model>
>    <xforms:instance>
>      <ecommerce xmlns="">
>        <method/>
>        <number/>
>        <expiry/>
>      </ecommerce>
>    </xforms:instance>
>    <xforms:submission action="http://example.com/submit" method="post"
> id="submit" includenamespaceprefixes=""/>
> </xforms:model>
> and applied to an html document:
> ...
> <select1 ref="method">
>    <label>Select Payment Method:</label>
>    <item>
>      <label>Cash</label>
>      <value>cash</value>
>    </item>
>    <item>
>      <label>Credit</label>
>      <value>cc</value>
>    </item>
> </select1>
> ...
> I concluded from this example that if I create an element 'testform'
> with a namespace 'generalinformation', the element 'select1' with
> attribute 'ref='generalinformation'' could be applied. This did not
> work so I removed the attribute 'ref'.
>> 2. The use of namespaces in the instance isn't quite right.   You might want to read up on an XML book on the topic, or just take a look at what I've done and generalize.
>> 3. Each form control needs a "ref" attribute with the path to the element in the instance where you want the data placed.   I've put some in that work, but you can of course change the instance data around.  If you need to move the elements down a level inside other elements, you'll need to use the XPath syntax "a/b/c" to get to element "c" inside "b" inside "a".  In XForms, you get the toplevel element name for free.
>> That ought to be make it work.  Here's the output I got once I made those changes:
>> <generalinformation><purpose>Building</purpose><weatherLlocation>London</weatherLocation></generalinformation>
>> Here's the updated form, and below that are some enhancements you might consider:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms">
>>   <head>
>>     <style type="text/css">
>>       code {text-color:black; background:white; font-family:verdana, sans-serif}
>>     </style>
>>     <xf:model>
>>       <xf:instance>
>>         <generalinformation xmlns="">
>>           <purpose />
>>           <weatherLocation />
>>         </generalinformation>
>>       </xf:instance>
>>       <xf:submission resource='file:testgeneral.xml' method="put" id="gi" />
>>     </xf:model>
>>     <title>
>>       test xml to csv for postgresql
>>     </title>
>>   </head>
>>   <body>
>>     <p>
>>       <xf:select1 ref="purpose" appearance='minimal'>
> The addition of the attribute 'ref' causes the list menu to disappear
> (tested in firefox version 2009, 304, 36rc2 and now using 368, all
> with suitable versions of the xforms plugin). All that appears is the
> button icon labelled 'send'. When I remove the attribute 'ref', the
> list menu reappears.
> René.
Received on Friday, 13 August 2010 18:04:19 UTC

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