RE: empty instance generates link exception?

Jason,

> also,
> from
> 	http://www.w3.org/TR/xforms/slice4.html#evt-modelConstructDone
> 
> it gives detail about what must happen when an instance never 
> exists, so presumably its possible to start out with zero instances.
> either this or we are placed in the ludicrous situation of 
> having to provide a dummy instance which is then completely 
> ignored whilst we load new instances after the form has started.
> if both of these options is impossible then  the condition 
> handled by this clause can never be reached.
> they cant have it both ways! ;-)
> am I missing something obvious here?

This is what is meant by "lazy authoring", which I was referring to in the
previous post, and it generally relies on the instance not existing.

In passing, it's worth saying that contrary to the generally held view that
XForms is more difficult than HTML forms, the following is a perfectly
valid, and fully working, XForms form:

  <html
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:xf="http://www.w3.org/2002/xforms"
  >
    <head>
      <title>Lazy Authoring</title>
    </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>

As with any other XForm, as you edit the values in 'fn' and 'sn', so the
calculated value on the output changes automatically, but obviously with no
need for scripting.

For lazy authoring to work, it's the lack of an instance that's key, not the
model. So the following will also work--a model with no instance:

  <html
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:xf="http://www.w3.org/2002/xforms"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  >
    <head>
      <title>Lazy Authoring</title>
      <xf:model>
        <xf:bind nodeset="biscuits" type="xsd:boolean" />
      </xf:model>
    </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>
      <xf:input ref="biscuits">
        <xf:label>Do you like biscuits?:</xf:label>
      </xf:input>
    </body>
  </html>

This combines two features of XForms; the first is that lazy authoring has
the effect of creating an instance automatically, and the second is that if
you don't specify an instance in your XPath expressions, then the 'first'
instance is used, and if you don't specify a model, the first model is used.

If anyone wants to comment, add examples, develop the explanation, etc.,
then the above text has been placed in a new topic on the XForms Wiki at:

  http://www.xforms-wiki.com/bin/view/Main/XformsLazyAuthoring

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/

Received on Friday, 6 January 2006 16:19:12 UTC