Re: empty instance generates link exception?

Mark Birbeck wrote:

> Hi Aaron,
> 
> 
>>I thought that this shouldn't work because you have no model. 
>> I know that you can lazy author instance, but I didn't think 
>>that you could lazy author the model along with it.  Can you 
>>lazy author a model or did you just miss the model element 
>>when you authored the example?
> 
> 
> No, those examples are fully working examples (minus the formsPlayer
> object/import tags, so as not to detract from the markup). There is no need
> for an empty model element.
> 
> Which reminds me of something I thought of ages ago, which is that it would
> be great if we allowed xf:submission outside of the model. This is because
> the next step on from the example I gave before would be to send the data to
> a server, ideally like this:
> 
>   <html
>    xmlns="http://www.w3.org/1999/xhtml"
>    xmlns:xf="http://www.w3.org/2002/xforms"
>   >
>     <head>
>       <title>Lazy Authoring</title>
>       <xf:submission
>        action="http://example.org/search.asp"
>        method="get"
>       />
>     </head>
>     <body>
>       <xf:input ref="fn">
>         <xf:label>First Name:</xf:label>
>       </xf:input>
>       <xf:input ref="sn">
>         <xf:label>Surname:</xf:label>
>       </xf:input>
>       <xf:output value="concat(fn, ' ', sn)">
>         <xf:label>Your full name is:</xf:label>
>       </xf:output>
>     </body>
>   </html>
> 
> Unfortunately you can't do this, and instead you have to wrap the submission
> in a model:
> 
>       .
>       .
>       .
>       <title>Lazy Authoring</title>
>       <xf:model>
>         <xf:submission
>          action="http://example.org/search.asp"
>          method="get"
>         />
>       </xf:model>
>       .
>       .
>       .
> 
> It's not a lot of work, but I think it's a shame because at this point in a
> new user's initiation into the world of XForms, there is no need to learn
> about models; even if you were to only use the following XForms features:
> 
>   * the various input controls;
>   * hints and help;
>   * xf:submission;
>   * xf:output with @value;
>   * ... and of course, 'lazy authoring'
> 
> you would already be able to create forms that can do more than the vast
> majority of current HTML forms, and you could do it with not a single line
> of script.
> 
> (And if anyone is wondering how come the submission in this example works,
> recall that the default for xf:submission/@ref is "/", and thanks to the
> 'first model, first instance' rule this will select the root node of the
> instance that was automatically created by 'lazy authoring'.)
> 
> Best regards,
> 
> Mark
> 
> 
> Mark Birbeck
> CEO
> x-port.net Ltd.
> 
> e: Mark.Birbeck@x-port.net
> t: +44 (0) 20 7689 9232
> w: http://www.formsPlayer.com/
> 
> Download our XForms processor from
> http://www.formsPlayer.com/
> 
> 
> 
> 

FYI Mark,

I tried your testcase and it did indeed work in fP 1.3.5.1018.  But this 
testcase didn't.

<?xml version="1.0" encoding="ASCII"?>
<html xmlns:xforms="http://www.w3.org/2002/xforms"
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:ev="http://www.w3.org/2001/xml-events">
   <head>
     <title>no model testcase</title>
   </head>
   <body>
     <h2> You should be able to enter a value in the input and have it 
reflected
          in the ouput after tabbing out of the input field.
     </h2>
     <h3> Exercises sec. 4.2.2 of the spec </h3>
     <xforms:group>
       <xforms:input ref="value">
         <xforms:label>label for input: </xforms:label>
       </xforms:input>
     </xforms:group>
     <xforms:group>
       <xforms:output ref="value">
         <xforms:label>value in the input field:</xforms:label>
       </xforms:output>
     </xforms:group>

<!-- Uncomment this and this testcase works -->
<!--
     <xforms:model/>
-->
   </body>
</html>

Received on Friday, 6 January 2006 23:17:05 UTC