Updating an instance using PFC

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Updating an instance using PFC

mjgraham
Hi,

In a particular XForm (page=register-org), I have:

<xforms:model>
  <xforms:instance id="instance">
    <form>
      <affil2/>
    </form>
  </xforms:instance>
  <xforms:instance id="data">
  ...

and the /form/affil2 value is passed on from a previous page (where it
is called /form/affil1) so my page-flow.xml has:

  <page id="register" path-info="/publish/register"
model="register-model.xpl" view="register-user.xhtml">
    <action when="/form/affil1 != ''" action="register-user.xpl">
      <result page="register-org" transform="oxf:xupdate">
        <xu:transformations>
          <xu:update select="instance('instance')/form/affil2">
            <xu:value-of select="doc('input:instance')/form/affil1"/>
          </xu:update>
        </xu:transformations>
      </result>
    </action>
  </page>

However, this throws an error about not being able to invoke the
instance function so how I can update /form/affil2 in
instance('instance') using a xu:update in page-flow?

    Cheers,

    Matthew



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Updating an instance using PFC

Erik Bruchez
Administrator
Matthew,

You cannot use the instance() function in your page flow. instance()
is an XForms function, and it will work only from XForms pages.

In OPS 3.0, PFC pages really do not know about XForms: they just
support the generic concept of an "XML submission", which means that
somehow, an XML document is submitted to a particular
page. Submissions can be external (e.g. XML-RPC POST on a page), or
internal (with the <result> element).

So wwhat you can do is, from a source page make a submission to a
destination page. This means the destination page will receive the XML
submission on its page actions, model and view's "instance"
inputs. You are then free to use XInclude or XSLT in your page view to
use that submitted XML document to prepopulate one of your XForms
instances.

All the details are documented here:

   http://www.orbeon.com/ops/doc/reference-page-flow#xml-submission

-Erik

Matthew Graham wrote:
 > Hi,
 >
 > In a particular XForm (page=register-org), I have:
 >
 > <xforms:model>
 >  <xforms:instance id="instance">
 >    <form>
 >      <affil2/>
 >    </form>
 >  </xforms:instance>
 >  <xforms:instance id="data">
 >  ...
 >
 > and the /form/affil2 value is passed on from a previous page (where it
 > is called /form/affil1) so my page-flow.xml has:
 >
 >  <page id="register" path-info="/publish/register"
 > model="register-model.xpl" view="register-user.xhtml">
 >    <action when="/form/affil1 != ''" action="register-user.xpl">
 >      <result page="register-org" transform="oxf:xupdate">
 >        <xu:transformations>
 >          <xu:update select="instance('instance')/form/affil2">
 >            <xu:value-of select="doc('input:instance')/form/affil1"/>
 >          </xu:update>
 >        </xu:transformations>
 >      </result>
 >    </action>
 >  </page>
 >
 > However, this throws an error about not being able to invoke the
 > instance function so how I can update /form/affil2 in
 > instance('instance') using a xu:update in page-flow?
 >
 >    Cheers,
 >
 >    Matthew




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws