RE: How can a text file be uploaded by XForms?

OK, I understand.

I'd recommend that you use a single instance for all of the form
subparts, and write the UI such that it binds to only part of the
instance at a time.  Saving out parts of the instance and trying to
recombine them later is going to cause you problems in XForms 1.0 and I
recommend you don't try it.

For Xforms 1.0, you can use <group ref="part2">...</group> or <group
ref="part3">...</group> etc. in the different parts of the form.  You
can also use <switch> to control which part of the UI is displayed.  You
can use a wizard style series of trigger controls with toggle inside at
the end of each case to move to the next, or you can have a navigation
bar style of parallel triggers, each of which takes you to the
appropriate section.

You will still have to deal with user agents that prohibit collecting
submitting data to any place except where the host document came from.
Mozilla XForms 0.1 has a note on MozillaZine forums explaining where
this setting is.  I don't know about the other processors.

Leigh.

----Example, not guaranteed to be working---

There are countless improvements you could make to this, but here's the
basic idea:

<model>
  <instance>
    <data xmlns="">
      <personal>
	 <name/>
	 <age/>
	 <email/>
      </personal>
      <business>
	 <office/>
	 <manager/>
	 <fax/>
      </business>
      <travel>
	 <hotel/>
	 <airline/>
	 <rentalcar/>
      </travel>
    </data>
  </instance>
  <bind nodeset="data/*/*" required="true()" />
  <submission id="save" method="put" action="file:///uptoyou.xml" />
  <submission id="finish" method="post" action="/cgi-bin/register.cgi"
/>
</model>
...
<switch>
  <case id="showPersonal">
    <group ref="personal">
      <input ref="name"><label>Name</label></input>
      ...
    </group>
  </case>
  <case id="showBusiness">
    <group ref="business">
      <input ref="office"><label>Office</label></input>
	...
    </group>
  </case>
  <case id="showTravel">
    <group ref="travel">
      <input ref="hotel"><label>Hotel</label></input>
	...
    </group>
  </case>
 </switch>
 <hr />
 <group class="navbar">
   <trigger>
     <label>Personal</label>
     <toggle case="showPersonal" />
   </trigger>
   <trigger>
     <label>Business</label>
     <toggle case="showBusiness" />
   </trigger>
   <trigger>
     <label>Travel</label>
     <toggle case="showTravel" />
   </trigger>
   <submit submission="save">
     <label>Save</label>
     <hint>Save this work to finish later</hint>
   </submit>
   <submit submission="finsh">
     <label>Finish</label>
     <hint>Finish the work</hint>
   </submit>
 </group>

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Kianoush Eshaghi
Sent: Friday, April 22, 2005 11:01 AM
To: Klotz, Leigh
Cc: www-forms@w3.org
Subject: AW: How can a text file be uploaded by XForms?


YES, It is my purpose exactly ;-))

freundliche Gruesse / best regards
Dipl.-Ing. Kianoush Eshaghi     T +43 1 74040-652
METADAT - The Architect for Knowledge Networks

> -----Ursprungliche Nachricht-----
> Von: Klotz, Leigh [mailto:Leigh.Klotz@xerox.com]
> Gesendet: Freitag, 22. April 2005 19:45
> An: Kianoush Eshaghi; Mark Birbeck
> Cc: www-forms@w3.org
> Betreff: RE: How can a text file be uploaded by XForms?
>
>
> Is the problem state you want to have a user fill out a form, save the

> data on the local disk, reboot the computer, come back the next day, 
> move to another part of the form, and repeat this process, and then 
> eventually combine all the saved files into one file and upload them 
> as one XML document?
>
> -----Original Message-----
> From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On 
> Behalf Of Kianoush Eshaghi
> Sent: Friday, April 22, 2005 2:58 AM
> To: 'Mark Birbeck'
> Cc: www-forms@w3.org
> Subject: AW: How can a text file be uploaded by XForms?
>
>
>
> > I'm sorry, but I'm still not fully getting it. Do you want
> there to be
>
> > an area of your form that actually shows the user the text
> file that
> > they have loaded? Or do you simply want to submit the text
> file to a
> > server, after the user has edited it?
>
> At first I want to save the XML instances, which has been occured by 
> user's filling in forms, thus I must use only the method "put" with 
> action="file:C:/...". If I use the method "multipart-post", then I 
> must use action="http://...", which can not save any instance into 
> some file.
> In extension of my purpose IE should be able to send instances to 
> server, which will work with them.
>
> > If the latter -- which I think is what you want, but I'm not quite 
> > sure -- then Leigh's answer in his previous post is exactly
> what you
> > need. By specifying a multipart/related post, formsPlayer
> will store
> > the URI of the document in the instance, rather than the full 
> > document.
> > Then, when your
> > users come to submit, formsPlayer will obtain the document from its 
> > location and send it to your server with the rest of your
> post. Your
> > server will then need to be able to process this.
>
> If it works with "multipart-post" method, which you have described, 
> then it will be super.
>
> Kianoush
>
> > e: Mark.Birbeck@x-port.net
> > t: +44 (0) 20 7689 9232
> > w: http://www.formsPlayer.com/
> > b: http://internet-apps.blogspot.com/
> >
> > Download our XForms processor from
> > http://www.formsPlayer.com/
> >
> > > -----Original Message-----
> > > From: Kianoush Eshaghi [mailto:Kianoush.Eshaghi@metadat.at]
> > > Sent: 21 April 2005 18:44
> > > To: www-forms@w3.org
> > > Cc: Mark.Birbeck@x-port.net
> > > Subject: WG: How can a text file be uploaded by XForms?
> > >
> > >
> > > Mark
> > >
> > > > Can I just check that I understand the issue? Are you
> > > saying that you
> > > > want to upload the file 'as is'? That is, you don't want to
> > > see it to
> > > > be stored in a binary or hex format?
> > >
> > > I want see it in my instance as like as the content of the file, 
> > > which has been uploaded, for example:
> > >
> > > I have a file, which contains following text data:
> > > <xx>
> > > 	<YY/>
> > > 	<ZZ/>
> > > 	...
> > > 	...
> > > </xx>
> > > If I submit the form, I want to have the following instance:
> > > <request>
> > > 	<description>
> > > 		<xx>
> > > 		<YY/>
> > > 		<ZZ/>
> > > 		...
> > > 		...
> > > 		</xx>
> > > 	</description>
> > > </request>
> > >
> > > > By the way, once the data is copied in, are you then going
> > > to submit
> > > > it to a server? Or are you going to do something else. I
> > > ask only to
> > > > try and understand what you are trying to do, in case there
> > > is another
> > > > way round it.
> > >
> > > First I want to create respective XML instances, and to
> save it into
>
> > > local file system, how I am going as following <xf:submission 
> > > method="put" action="file:C:/result.xml"/> It works well.
> But If I
> > > try to use http in action="http://localhost/result.xml"
> > > method="put", I will get the HTTP Error message that resource(?) 
> > > isn't permitted(?)
> > >
> > > Second I want to send the created XML instance to a
> particular XML
> > > Web Services, which is installed on tomcat server. I've tried 
> > > <xf:submission method="post"
> > > action="http://localhost:8080/CART"/>, but it hasn't also
> gone ;-((
> > >
> > > > (For example, a quick resolution would be to use an XPath
> > extension
> > > > function to 'unencode' the base64 data back to text. A bit 
> > > > long-winded, I know, but it may address your issue for now.)
> > >
> > > hi, good idea, but I am new by XPath, Could you point me
> > according to?
> > >
> > > Kianoush
> > >
> > > > Mark Birbeck
> > > > CEO
> > > > x-port.net Ltd.
> > > >
> > > > e: Mark.Birbeck@x-port.net
> > > > t: +44 (0) 20 7689 9232
> > > > w: http://www.formsPlayer.com/
> > > > b: http://internet-apps.blogspot.com/
> > > >
> > > > Download our XForms processor from http://www.formsPlayer.com/
> > > >
> > > > > -----Original Message-----
> > > > > From: www-forms-request@w3.org 
> > > > > [mailto:www-forms-request@w3.org] On Behalf Of
> Kianoush Eshaghi
> > > > > Sent: 21 April 2005 16:38
> > > > > To: www-forms@w3.org
> > > > > Subject: How can a text file be uploaded by XForms?
> > > > >
> > > > >
> > > > > Hi everybody!
> > > > >
> > > > > I have implemented a form using XForms, whereby I use
> > IE Plug-In
> > > > > (FormsPlayer 1.3). I want to built some control element
> > > in the form
> > > > > control, which enable to upload some text file (with
> > extend .txt)
> > > > > into some node of my XML instance.
> > > > > I've used <xforms:upload/> in my form control, and set
> > > the type of
> > > > > node in instance as type="xsd:base64Binary"
> > > > > as following:
> > > > >
> > > > > <xf:model>
> > > > > 	<xf:instance>
> > > > > 		<request>
> > > > > 			<description/>
> > > > > 		</request>
> > > > > 	</xf:instance>
> > > > > 	<xf:bind id="des" nodeset="/request/description"
> > > > > type="xsd:base64Binary"/>
> > > > > </xf:model>
> > > > >
> > > > > <xf:upload bind="des">
> > > > > 	<xf:label>Select the file:</xf:label>
> > </xf:upload> <xf:output
> > > > > bind="des"/>
> > > > >
> > > > > But I get as xml instance (output control) after
> > uploading of the
> > > > > text file some other encoded symbols.
> > > > >
> > > > > How can I upload the content of the text file without any
> > > encoding
> > > > > at the text into instance? I have tried with
> > > "xsd:string", but the
> > > > > FormsPlayer cries ;-( that the instance is invalid.
> > > > >
> > > > > I appreciate your tips and pointers.
> > > > >
> > > > > freundliche Gruesse / best regards
> > > > > Dipl.-Ing. Kianoush Eshaghi     T +43 1 74040-652
> > > > > METADAT - The Architect for Knowledge Networks
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
> >
>
>
>

Received on Monday, 25 April 2005 17:41:36 UTC