[Fwd: Re: New to XForms - having difficulty]

hit the wrong button when replying, fwding to list

-------- Original Message --------
Subject: Re: New to XForms - having difficulty
Date: Tue, 23 Sep 2003 19:08:26 +0200
From: Stefano Debenedetti <ste@mozquito.com>
To: Allen.P.Holtz <allen.p.holtz@nasa.gov>
References: <1064328505.1300.155.camel@aholtz.grc.nasa.gov>

Hello, the action attribute behaves exactly as the action attribute on the html form tag: it specifies a URI the data will be submitted to. How the data will be submitted is regulated by the combination of the method and mediatype attributes (see the table in paragraph 11.2 of the XForms spec).
Examples:

1) to submit data as XML using mediatype application/xml:

<xform:submission action="http://example.org/mycgi" id="submit1" method="post"/>

2) to submit data as name/value pairs using mediatype application/x-www-form-urlencoded (like html forms):

<xform:submission action="http://example.org/mycgi" id="submit1" method="get"/>

3) don't take my word for it but I think you are also allowed to:

<xform:submission action="http://example.org/mycgi" id="submit1" method="post" mediatype="application/x-www-form-urlencoded"/>

Of course on the server-side you must have something listening to submissions and eventually saving the data for later use. If you submit stuff like in examples 2) or 3) you can access the name/value pairs using your favorite library for parsing CGI parameters, if you submit like in 1) then the body of the request your server receives can be assumed to be an XML doc ready for being parsed or saved on disk as is for later use.

As a sidenote, make sure you specify what submission your submit must submit, like this:

<xform:submit submission="submit1">
 <xform:label>Submit Scenario</xform:label>
</xform:submit>

The error you are getting is probably due to the lack of a submission attribute on the submit element, which is mandatory.

Hope this helps, ciao
ste

Allen.P.Holtz wrote:
> Hi,
> 
>    I'm relatively new to XForms and I am having some difficulties with
> submitting a form.  I have a form that I would like to submit once the
> user has entered the data.  The problem is, I'm not sure how that
> happens.  I think my problem is on the web server.  
> 
>    First, in the model I am defining the submission.  It looks something
> like this:
> 
> <xform:submission action="request" id="submit1" method="post"/>
> 
> Initially, it appeared that the action attribute was defining a file on
> the web server that would be executed upon submission by the user. 
> After I read the specs I'm not so sure that's the case anymore.  The
> method attribute is the method of submission.  
> 
> Later on in my document I have the following:
> 
>    <xform:submit>
>       <xform:label>Submit Scenario</xform:label>
>    </xform:submit>
> 
> When I try this, I get an error.  What kind of file is this request file
> that is listed in the action attribute?  Also, am I on the right track? 
> All I want to do is get the XML data into a file for now.  Later I want
> to pipe it in to an application.
> 
> Thanks,
> 
> Allen
> 
> 

Received on Tuesday, 23 September 2003 13:36:41 UTC