XForms 1.1 duplicate action?

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

XForms 1.1 duplicate action?

Larry T. Chen
Hi,

Are there plans to implement the duplicate action of XForms 1.1 soon?

Without the ability to insert into an empty list, I find that the XForms
processing becomes very tedious, because I have to merge every XML
instance data file that comes out of the database with an empty instance
of the XML so that the insert actions have a template to insert with.  
Then of course there needs to be a bind statement for practically every
element to hide the last (template) element of the list.

I also have many sections of the form which are optional sections (i.e.
minOccurs = 0 and maxOccurs = 1 in XML Schema), yet I still have to keep
a template of these and have bind statements to hide these sections.

Obviously this is not the fault of Orbeon itself but of the XForms 1.0
spec.  But I'm wondering is there a better way to handle this as of
now?  I'm hoping the XForms 1.1 duplicate action can get implemented
soon, but I'll deal with whatever I need to do to get a working solution
now.

Thank you for the great support and keep up the good work.

Larry T. Chen
Software Engineer
Intelenet Communications, Inc.








--
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: XForms 1.1 duplicate action?

Erik Bruchez
Administrator
Larry,

 > Are there plans to implement the duplicate action of XForms 1.1
 > soon?

No, because XForms 1.1 does not have a duplicate action! But I am of
course teasing you. Keep reading below.

 > Without the ability to insert into an empty list, I find that the
 > XForms processing becomes very tedious, because I have to merge
 > every XML instance data file that comes out of the database with an
 > empty instance of the XML so that the insert actions have a template
 > to insert with.  Then of course there needs to be a bind statement
 > for practically every element to hide the last (template) element of
 > the list.  I also have many sections of the form which are optional
 > sections (i.e.  minOccurs = 0 and maxOccurs = 1 in XML Schema), yet
 > I still have to keep a template of these and have bind statements to
 > hide these sections.
 >
 > Obviously this is not the fault of Orbeon itself but of the XForms
 > 1.0 spec.  But I'm wondering is there a better way to handle this as
 > of now?  I'm hoping the XForms 1.1 duplicate action can get
 > implemented soon, but I'll deal with whatever I need to do to get a
 > working solution now.

Of course, you are right to say that this was a big hole in XForms
1.0. It is an absolutely necessary feature.

The latest XForms 1.1 draft now implements duplication with the
@origin attribute on <xforms:insert>:

   http://www.w3.org/TR/xforms11/#insert-action

Support for @origin is implemented in OPS since 3.0:

   http://www.orbeon.com/ops/doc/reference-xforms-ng#origin-attribute

Hopefully support for @context will be implemented soon (it's easy to
implement).

The former attribute allows you to insert from any template you want
(as opposed to "the last element in a node-set"). The latter attribute
allows you to insert inside an element which is completely empty.

The "DMV Forms" example already implements the insertion of addresses
though this mechanism. I suggest you have a look at the source code:

   http://www.orbeon.com/ops/goto-source/forms/detail/detail-view.xhtml

Here are some relevant parts:

<!-- XForms instance containing template for mailing address -->
<xforms:instance id="mailing-address-template-instance"
   src="oxf:/examples/forms/schema/template-mailing-address.xml"/>

<xforms:action ev:event="DOMActivate">
   <xforms:insert
 
nodeset="instance('main-instance')//dmv:address-information/dmv:address"
     at="last()" position="after"
     origin="instance('mailing-address-template-instance')"/>
</xforms:action>

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: XForms 1.1 duplicate action?

Larry T. Chen
Erik,

Thanks for the quick reply.  I knew about the origin attribute on the insert action, but since it didn't work on an empty repeat, I gave up on it since I'm still forced to create a skeleton XML instance and merge existing data with it.  So what I really need is that new context attribute on the insert action so I can insert into an empty repeat.

Having that ability will really simplify the majority of my forms and pipeline processing (I'm sure for a lot of other users as well who need to manage lists with XForms).

So I'd like to put in a formal feature request to have the context attribute implemented.  Thanks again.

Larry T. Chen
Software Engineer
Intelenet Communications

Erik Bruchez wrote:
Larry,

> Are there plans to implement the duplicate action of XForms 1.1
> soon?

No, because XForms 1.1 does not have a duplicate action! But I am of
course teasing you. Keep reading below.

> Without the ability to insert into an empty list, I find that the
> XForms processing becomes very tedious, because I have to merge
> every XML instance data file that comes out of the database with an
> empty instance of the XML so that the insert actions have a template
> to insert with.  Then of course there needs to be a bind statement
> for practically every element to hide the last (template) element of
> the list.  I also have many sections of the form which are optional
> sections (i.e.  minOccurs = 0 and maxOccurs = 1 in XML Schema), yet
> I still have to keep a template of these and have bind statements to
> hide these sections.
>
> Obviously this is not the fault of Orbeon itself but of the XForms
> 1.0 spec.  But I'm wondering is there a better way to handle this as
> of now?  I'm hoping the XForms 1.1 duplicate action can get
> implemented soon, but I'll deal with whatever I need to do to get a
> working solution now.

Of course, you are right to say that this was a big hole in XForms
1.0. It is an absolutely necessary feature.

The latest XForms 1.1 draft now implements duplication with the
@origin attribute on <xforms:insert>:

  http://www.w3.org/TR/xforms11/#insert-action

Support for @origin is implemented in OPS since 3.0:

  http://www.orbeon.com/ops/doc/reference-xforms-ng#origin-attribute

Hopefully support for @context will be implemented soon (it's easy to
implement).

The former attribute allows you to insert from any template you want
(as opposed to "the last element in a node-set"). The latter attribute
allows you to insert inside an element which is completely empty.

The "DMV Forms" example already implements the insertion of addresses
though this mechanism. I suggest you have a look at the source code:

  http://www.orbeon.com/ops/goto-source/forms/detail/detail-view.xhtml

Here are some relevant parts:

<!-- XForms instance containing template for mailing address -->
<xforms:instance id="mailing-address-template-instance"
  src="oxf:/examples/forms/schema/template-mailing-address.xml"/>

<xforms:action ev:event="DOMActivate">
  <xforms:insert

nodeset="instance('main-instance')//dmv:address-information/dmv:address"
    at="last()" position="after"
    origin="instance('mailing-address-template-instance')"/>
</xforms:action>

-Erik


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



--
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: XForms 1.1 duplicate action?

Erik Bruchez
Administrator
Larry,

 > Thanks for the quick reply.  I knew about the origin attribute on
 > the insert action, but since it didn't work on an empty repeat, I
 > gave up on it since I'm still forced to create a skeleton XML
 > instance and merge existing data with it.  So what I really need is
 > that new context attribute on the insert action so I can insert into
 > an empty repeat.
 >
 > Having that ability will really simplify the majority of my forms
 > and pipeline processing (I'm sure for a lot of other users as well
 > who need to manage lists with XForms).
 >
 > So I'd like to put in a formal feature request to have the context
 > attribute implemented.  Thanks again.

This is now implemented. In fact, I have reworked the insert action to
follow much more closely its current description in the XForms 1.1
draft. For example, you can now insert attributes as well.

I attach a simple example that shows how things work.

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/


--
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

insert.xhtml (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XForms 1.1 duplicate action?

Larry T. Chen
Wow that was fast!  You guys are just amazing.  (How many hours do you
work everyday?)  Thanks a million.  Now having the ability to insert
into an empty element really completes the toolset needed to make XForms
work for any situation.  I will be testing it out soon!

Larry

Erik Bruchez wrote:

> Larry,
>
> > Thanks for the quick reply.  I knew about the origin attribute on
> > the insert action, but since it didn't work on an empty repeat, I
> > gave up on it since I'm still forced to create a skeleton XML
> > instance and merge existing data with it.  So what I really need is
> > that new context attribute on the insert action so I can insert into
> > an empty repeat.
> >
> > Having that ability will really simplify the majority of my forms
> > and pipeline processing (I'm sure for a lot of other users as well
> > who need to manage lists with XForms).
> >
> > So I'd like to put in a formal feature request to have the context
> > attribute implemented.  Thanks again.
>
> This is now implemented. In fact, I have reworked the insert action to
> follow much more closely its current description in the XForms 1.1
> draft. For example, you can now insert attributes as well.
>
> I attach a simple example that shows how things work.
>
> -Erik
>
> ------------------------------------------------------------------------
>
>
> --
> 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
>  



--
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: XForms 1.1 duplicate action?

Erik Bruchez
Administrator
He he, *sometimes* we are really fast, and sometimes not as fast :-)

Let us know if this works for you.

-Erik

Larry T. Chen wrote:

> Wow that was fast!  You guys are just amazing.  (How many hours do you
> work everyday?)  Thanks a million.  Now having the ability to insert
> into an empty element really completes the toolset needed to make XForms
> work for any situation.  I will be testing it out soon!
>
> Larry
>
> Erik Bruchez wrote:
>> Larry,
>>
>> > Thanks for the quick reply.  I knew about the origin attribute on
>> > the insert action, but since it didn't work on an empty repeat, I
>> > gave up on it since I'm still forced to create a skeleton XML
>> > instance and merge existing data with it.  So what I really need is
>> > that new context attribute on the insert action so I can insert into
>> > an empty repeat.
>> >
>> > Having that ability will really simplify the majority of my forms
>> > and pipeline processing (I'm sure for a lot of other users as well
>> > who need to manage lists with XForms).
>> >
>> > So I'd like to put in a formal feature request to have the context
>> > attribute implemented.  Thanks again.
>>
>> This is now implemented. In fact, I have reworked the insert action to
>> follow much more closely its current description in the XForms 1.1
>> draft. For example, you can now insert attributes as well.
>>
>> I attach a simple example that shows how things work.
>>
>> -Erik
--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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
|

Page Flow Controller Bug? Model not invoked when view is XPL

Larry T. Chen
In reply to this post by Erik Bruchez
Hi,

I've run into what is apparently a bug in the page flow controller:
When I use a static xhtml file for the view in a page, everything is
fine .. the model gets invoked properly and feeds its output to the view

    <page path-info="/SOF/edit" view="SOF-edit.xhtml" model="SOF-edit.xpl"/>

However, when I change the view to an XPL file to generate the view
dynamically, the model fails to get invoked by the page flow controller,
even though the view generates properly:

    <page path-info="/SOF/edit" view="generate-SOF-edit.xpl"
model="SOF-edit.xpl"/>

I'm actually generating all of my XForms via an XSLT transformation from
XML schema.  It's working pretty well now, except for this problem.  
Please let me know if this is a bug or an intended "feature."  Thank you
very much.

Larry T. Chen
Software Engineer
Intelenet Communications




--
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: Page Flow Controller Bug? Model not invoked when view is XPL

Alessandro  Vernet
Administrator
Hi Larry,

How is the data from the model fed to the view in the case where the
view is an XPL file? You should have a <p:param name="data"
type="input"/> in the view, and that "data" input is the output from
the model. Do you have something different?

Alex

On 6/14/06, Larry T. Chen <[hidden email]> wrote:

> Hi,
>
> I've run into what is apparently a bug in the page flow controller:
> When I use a static xhtml file for the view in a page, everything is
> fine .. the model gets invoked properly and feeds its output to the view
>
>     <page path-info="/SOF/edit" view="SOF-edit.xhtml" model="SOF-edit.xpl"/>
>
> However, when I change the view to an XPL file to generate the view
> dynamically, the model fails to get invoked by the page flow controller,
> even though the view generates properly:
>
>     <page path-info="/SOF/edit" view="generate-SOF-edit.xpl"
> model="SOF-edit.xpl"/>
>
> I'm actually generating all of my XForms via an XSLT transformation from
> XML schema.  It's working pretty well now, except for this problem.
> Please let me know if this is a bug or an intended "feature."  Thank you
> very much.
>
> Larry T. Chen
> Software Engineer
> Intelenet Communications
>
>
>
>
>
> --
> 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
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Page Flow Controller Bug? Model not invoked when view is XPL

Larry T. Chen
Alessandro,

I was expecting the model to feed its output to the view the same way it feeds to a static XForm, via the
      <xi:include href="input:data"/> on the XPL-generated XForm.   So you're saying that the view XPL should take an input parameter and then use that to generate the XForm model instance, rather than using <xi:include href="input:data"/> as we would normally do with a static XForm?

Larry



Alessandro Vernet wrote:
Hi Larry,

How is the data from the model fed to the view in the case where the
view is an XPL file? You should have a <p:param name="data"
type="input"/> in the view, and that "data" input is the output from
the model. Do you have something different?

Alex

On 6/14/06, Larry T. Chen [hidden email] wrote:
Hi,

I've run into what is apparently a bug in the page flow controller:
When I use a static xhtml file for the view in a page, everything is
fine .. the model gets invoked properly and feeds its output to the view

    <page path-info="/SOF/edit" view="SOF-edit.xhtml" model="SOF-edit.xpl"/>

However, when I change the view to an XPL file to generate the view
dynamically, the model fails to get invoked by the page flow controller,
even though the view generates properly:

    <page path-info="/SOF/edit" view="generate-SOF-edit.xpl"
model="SOF-edit.xpl"/>

I'm actually generating all of my XForms via an XSLT transformation from
XML schema.  It's working pretty well now, except for this problem.
Please let me know if this is a bug or an intended "feature."  Thank you
very much.

Larry T. Chen
Software Engineer
Intelenet Communications





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






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



--
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: Page Flow Controller Bug? Model not invoked when view is XPL

Alessandro  Vernet
Administrator
Hi Larry,

Yes, this is correct. When your view is a XPL file, how is the XForms
generated? If it is with XSLT, you will need to connect the input of
XSLT to the "data" input of the view pipeline.

Alex

On 6/15/06, Larry T. Chen <[hidden email]> wrote:

>
>  Alessandro,
>
>  I was expecting the model to feed its output to the view the same way it
> feeds to a static XForm, via the
>        <xi:include href="input:data"/> on the XPL-generated XForm.   So
> you're saying that the view XPL should take an input parameter and then use
> that to generate the XForm model instance, rather than using <xi:include
> href="input:data"/> as we would normally do with a static XForm?
>
>  Larry
>
>
>
>  Alessandro Vernet wrote:
> Hi Larry,
>
>  How is the data from the model fed to the view in the case where the
>  view is an XPL file? You should have a <p:param name="data"
>  type="input"/> in the view, and that "data" input is the output from
>  the model. Do you have something different?
>
>  Alex
>
>  On 6/14/06, Larry T. Chen <[hidden email]> wrote:
>
> Hi,
>
>  I've run into what is apparently a bug in the page flow controller:
>  When I use a static xhtml file for the view in a page, everything is
>  fine .. the model gets invoked properly and feeds its output to the view
>
>      <page path-info="/SOF/edit" view="SOF-edit.xhtml"
> model="SOF-edit.xpl"/>
>
>  However, when I change the view to an XPL file to generate the view
>  dynamically, the model fails to get invoked by the page flow controller,
>  even though the view generates properly:
>
>      <page path-info="/SOF/edit" view="generate-SOF-edit.xpl"
>  model="SOF-edit.xpl"/>
>
>  I'm actually generating all of my XForms via an XSLT transformation from
>  XML schema.  It's working pretty well now, except for this problem.
>  Please let me know if this is a bug or an intended "feature."  Thank you
>  very much.
>
>  Larry T. Chen
>  Software Engineer
>  Intelenet Communications
>
>
>
>
>
>  --
>  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
>
>
>
>
>
>
> ________________________________
>
>  -- 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
>
>
>
> --
> 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
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: XForms 1.1 duplicate action?

Adrian Baker-2
In reply to this post by Erik Bruchez
I've got form using the new context & origin attributes to insert into an empty nodeset - it works well, except that it seems to be doing a prepend when it should be doing an append. Attached is an example - click on the links on the bottom left area to add new conditions to the repeat. You'll see each new condition appears at the beginning of the list, rather than the end. The relevant insert action:

    <xforms:insert context="instance('query')" nodeset="condition" origin="instance('template-condition')" />

From the example of append & prepend at http://www.w3.org/TR/xforms11/#insert-action it seems that should be inserting the new node *after* any existing nodes. Fiddling with at & position didn't seem to help.

Workaround might be to use a conditional actions (yay) so a different insert is used when there are existing conditions.

Adrian

Erik Bruchez wrote:
He he, *sometimes* we are really fast, and sometimes not as fast :-)

Let us know if this works for you.

-Erik

Larry T. Chen wrote:
Wow that was fast!  You guys are just amazing.  (How many hours do you work everyday?)  Thanks a million.  Now having the ability to insert into an empty element really completes the toolset needed to make XForms work for any situation.  I will be testing it out soon!

Larry

Erik Bruchez wrote:
Larry,

> Thanks for the quick reply.  I knew about the origin attribute on
> the insert action, but since it didn't work on an empty repeat, I
> gave up on it since I'm still forced to create a skeleton XML
> instance and merge existing data with it.  So what I really need is
> that new context attribute on the insert action so I can insert into
> an empty repeat.
>
> Having that ability will really simplify the majority of my forms
> and pipeline processing (I'm sure for a lot of other users as well
> who need to manage lists with XForms).
>
> So I'd like to put in a formal feature request to have the context
> attribute implemented.  Thanks again.

This is now implemented. In fact, I have reworked the insert action to
follow much more closely its current description in the XForms 1.1
draft. For example, you can now insert attributes as well.

I attach a simple example that shows how things work.

-Erik


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


badRepeatAdd.xhtml (57K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XForms 1.1 duplicate action?

Adrian Baker-2
Ok so my attempts at using conditional actions as a workaround aren't working so well.

Attached is an example which upon executing the insert action (click on a link) throws a NullPointerException in this exception handler in org.orbeon.saxon.dom4j.NodeWrapper  because the context node is null. I guess this is the main issue, but the catch clause might also need changing to be a bit more defensive, or a null check made earlier (not totally sure if this is a Saxon code or OPS though).

    throw new IllegalArgumentException("Bad node type in dom4j! " + node.getClass() + " instance " + node.toString());

2006-06-22 18:54:27,566 ERROR org.orbeon.oxf.webapp.ProcessorService  - Exception at null, line -1, column -1
java.lang.NullPointerException
    at org.orbeon.saxon.dom4j.NodeWrapper.makeWrapper(NodeWrapper.java:98)
    at org.orbeon.saxon.dom4j.NodeWrapper.makeWrapper(NodeWrapper.java:61)
    at org.orbeon.saxon.dom4j.DocumentWrapper.wrap(DocumentWrapper.java:61)
    at org.orbeon.oxf.xforms.DocumentXPathEvaluator.evaluate(DocumentXPathEvaluator.java:49)
    at org.orbeon.oxf.xforms.XFormsInstance.evaluateXPath(XFormsInstance.java:215)
    at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:74)
    at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:173)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.runAction(XFormsContainingDocument.java:793)
    at org.orbeon.oxf.xforms.event.XFormsEventHandlerImpl.handleEvent(XFormsEventHandlerImpl.java:85)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.dispatchEvent(XFormsContainingDocument.java:729)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.interpretEvent(XFormsContainingDocument.java:447)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.executeExternalEvent(XFormsContainingDocument.java:433)
    at org.orbeon.oxf.xforms.processor.XFormsServer.executeExternalEventPrepareIfNecessary(XFormsServer.java:282)
    at org.orbeon.oxf.xforms.processor.XFormsServer.doIt(XFormsServer.java:233)

I've been able to use if on an action elsewhere, but it was on a setvalue outside of a repeat.

Adrian


Adrian Baker wrote:
I've got form using the new context & origin attributes to insert into an empty nodeset - it works well, except that it seems to be doing a prepend when it should be doing an append. Attached is an example - click on the links on the bottom left area to add new conditions to the repeat. You'll see each new condition appears at the beginning of the list, rather than the end. The relevant insert action:

    <xforms:insert context="instance('query')" nodeset="condition" origin="instance('template-condition')" />

From the example of append & prepend at http://www.w3.org/TR/xforms11/#insert-action it seems that should be inserting the new node *after* any existing nodes. Fiddling with at & position didn't seem to help.

Workaround might be to use a conditional actions (yay) so a different insert is used when there are existing conditions.

Adrian

Erik Bruchez wrote:
He he, *sometimes* we are really fast, and sometimes not as fast :-)

Let us know if this works for you.

-Erik

Larry T. Chen wrote:
Wow that was fast!  You guys are just amazing.  (How many hours do you work everyday?)  Thanks a million.  Now having the ability to insert into an empty element really completes the toolset needed to make XForms work for any situation.  I will be testing it out soon!

Larry

Erik Bruchez wrote:
Larry,

> Thanks for the quick reply.  I knew about the origin attribute on
> the insert action, but since it didn't work on an empty repeat, I
> gave up on it since I'm still forced to create a skeleton XML
> instance and merge existing data with it.  So what I really need is
> that new context attribute on the insert action so I can insert into
> an empty repeat.
>
> Having that ability will really simplify the majority of my forms
> and pipeline processing (I'm sure for a lot of other users as well
> who need to manage lists with XForms).
>
> So I'd like to put in a formal feature request to have the context
> attribute implemented.  Thanks again.

This is now implemented. In fact, I have reworked the insert action to
follow much more closely its current description in the XForms 1.1
draft. For example, you can now insert attributes as well.

I attach a simple example that shows how things work.

-Erik


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


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

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


nullPointerOnInsert.xhtml (54K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XForms 1.1 duplicate action?

Erik Bruchez
Administrator
In reply to this post by Adrian Baker-2
Adrian,

We have independently found a bug with @context/@nodeset as well:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=305569&group_id=168&atid=350207

We will look at that soon.

-Erik

Adrian Baker wrote:

> I've got form using the new context & origin attributes to insert into
> an empty nodeset - it works well, except that it seems to be doing a
> prepend when it should be doing an append. Attached is an example -
> click on the links on the bottom left area to add new conditions to the
> repeat. You'll see each new condition appears at the beginning of the
> list, rather than the end. The relevant insert action:
>
>     <xforms:insert context="instance('query')" nodeset="condition"
> origin="instance('template-condition')" />
>
>  From the example of append & prepend at
> http://www.w3.org/TR/xforms11/#insert-action it seems that should be
> inserting the new node *after* any existing nodes. Fiddling with at &
> position didn't seem to help.
>
> Workaround might be to use a conditional actions (yay) so a different
> insert is used when there are existing conditions.
>
> Adrian
>
> Erik Bruchez wrote:
>> He he, *sometimes* we are really fast, and sometimes not as fast :-)
>>
>> Let us know if this works for you.
>>
>> -Erik
>>
>> Larry T. Chen wrote:
>>> Wow that was fast!  You guys are just amazing.  (How many hours do
>>> you work everyday?)  Thanks a million.  Now having the ability to
>>> insert into an empty element really completes the toolset needed to
>>> make XForms work for any situation.  I will be testing it out soon!
>>>
>>> Larry
>>>
>>> Erik Bruchez wrote:
>>>> Larry,
>>>>
>>>> > Thanks for the quick reply.  I knew about the origin attribute on
>>>> > the insert action, but since it didn't work on an empty repeat, I
>>>> > gave up on it since I'm still forced to create a skeleton XML
>>>> > instance and merge existing data with it.  So what I really need is
>>>> > that new context attribute on the insert action so I can insert into
>>>> > an empty repeat.
>>>> >
>>>> > Having that ability will really simplify the majority of my forms
>>>> > and pipeline processing (I'm sure for a lot of other users as well
>>>> > who need to manage lists with XForms).
>>>> >
>>>> > So I'd like to put in a formal feature request to have the context
>>>> > attribute implemented.  Thanks again.
>>>>
>>>> This is now implemented. In fact, I have reworked the insert action to
>>>> follow much more closely its current description in the XForms 1.1
>>>> draft. For example, you can now insert attributes as well.
>>>>
>>>> I attach a simple example that shows how things work.
>>>>
>>>> -Erik
>>
>> ------------------------------------------------------------------------
>>
>>
>> --
>> 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
>>  
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: XForms 1.1 duplicate action?

Erik Bruchez
Administrator
In reply to this post by Adrian Baker-2
Adrian,

I think this exact same NPE was fixed yesterday. You may have some luck
with a newer build.

-Erik

Adrian Baker wrote:

> Ok so my attempts at using conditional actions as a workaround aren't
> working so well.
>
> Attached is an example which upon executing the insert action (click on
> a link) throws a NullPointerException in this exception handler in
> org.orbeon.saxon.dom4j.NodeWrapper  because the context node is null. I
> guess this is the main issue, but the catch clause might also need
> changing to be a bit more defensive, or a null check made earlier (not
> totally sure if this is a Saxon code or OPS though).
>
>     throw new IllegalArgumentException("Bad node type in dom4j! " +
> node.getClass() + " instance " + node.toString());
>
> 2006-06-22 18:54:27,566 ERROR org.orbeon.oxf.webapp.ProcessorService  -
> Exception at null, line -1, column -1
> java.lang.NullPointerException
>     at org.orbeon.saxon.dom4j.NodeWrapper.makeWrapper(NodeWrapper.java:98)
>     at org.orbeon.saxon.dom4j.NodeWrapper.makeWrapper(NodeWrapper.java:61)
>     at org.orbeon.saxon.dom4j.DocumentWrapper.wrap(DocumentWrapper.java:61)
>     at
> org.orbeon.oxf.xforms.DocumentXPathEvaluator.evaluate(DocumentXPathEvaluator.java:49)
>     at
> org.orbeon.oxf.xforms.XFormsInstance.evaluateXPath(XFormsInstance.java:215)
>     at
> org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:74)
>     at
> org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:173)
>     at
> org.orbeon.oxf.xforms.XFormsContainingDocument.runAction(XFormsContainingDocument.java:793)
>     at
> org.orbeon.oxf.xforms.event.XFormsEventHandlerImpl.handleEvent(XFormsEventHandlerImpl.java:85)
>     at
> org.orbeon.oxf.xforms.XFormsContainingDocument.dispatchEvent(XFormsContainingDocument.java:729)
>     at
> org.orbeon.oxf.xforms.XFormsContainingDocument.interpretEvent(XFormsContainingDocument.java:447)
>     at
> org.orbeon.oxf.xforms.XFormsContainingDocument.executeExternalEvent(XFormsContainingDocument.java:433)
>     at
> org.orbeon.oxf.xforms.processor.XFormsServer.executeExternalEventPrepareIfNecessary(XFormsServer.java:282)
>     at
> org.orbeon.oxf.xforms.processor.XFormsServer.doIt(XFormsServer.java:233)
>
> I've been able to use if on an action elsewhere, but it was on a
> setvalue outside of a repeat.
>
> Adrian
>
>
> Adrian Baker wrote:
>> I've got form using the new context & origin attributes to insert into
>> an empty nodeset - it works well, except that it seems to be doing a
>> prepend when it should be doing an append. Attached is an example -
>> click on the links on the bottom left area to add new conditions to
>> the repeat. You'll see each new condition appears at the beginning of
>> the list, rather than the end. The relevant insert action:
>>
>>     <xforms:insert context="instance('query')" nodeset="condition"
>> origin="instance('template-condition')" />
>>
>> From the example of append & prepend at
>> http://www.w3.org/TR/xforms11/#insert-action it seems that should be
>> inserting the new node *after* any existing nodes. Fiddling with at &
>> position didn't seem to help.
>>
>> Workaround might be to use a conditional actions (yay) so a different
>> insert is used when there are existing conditions.
>>
>> Adrian
>>
>> Erik Bruchez wrote:
>>> He he, *sometimes* we are really fast, and sometimes not as fast :-)
>>>
>>> Let us know if this works for you.
>>>
>>> -Erik
>>>
>>> Larry T. Chen wrote:
>>>> Wow that was fast!  You guys are just amazing.  (How many hours do
>>>> you work everyday?)  Thanks a million.  Now having the ability to
>>>> insert into an empty element really completes the toolset needed to
>>>> make XForms work for any situation.  I will be testing it out soon!
>>>>
>>>> Larry
>>>>
>>>> Erik Bruchez wrote:
>>>>> Larry,
>>>>>
>>>>> > Thanks for the quick reply.  I knew about the origin attribute on
>>>>> > the insert action, but since it didn't work on an empty repeat, I
>>>>> > gave up on it since I'm still forced to create a skeleton XML
>>>>> > instance and merge existing data with it.  So what I really need is
>>>>> > that new context attribute on the insert action so I can insert into
>>>>> > an empty repeat.
>>>>> >
>>>>> > Having that ability will really simplify the majority of my forms
>>>>> > and pipeline processing (I'm sure for a lot of other users as well
>>>>> > who need to manage lists with XForms).
>>>>> >
>>>>> > So I'd like to put in a formal feature request to have the context
>>>>> > attribute implemented.  Thanks again.
>>>>>
>>>>> This is now implemented. In fact, I have reworked the insert action to
>>>>> follow much more closely its current description in the XForms 1.1
>>>>> draft. For example, you can now insert attributes as well.
>>>>>
>>>>> I attach a simple example that shows how things work.
>>>>>
>>>>> -Erik
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> --
>>> 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
>>>  
>>
>>
>> ______________________________________________________________________
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email
>> ______________________________________________________________________
>> ------------------------------------------------------------------------
>>
>>
>> --
>> 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
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: XForms 1.1 duplicate action?

Adrian Baker-2
Great, thanks - yes with an update the exception has gone. I still have another issue, which I'll follow up on shortly, but is there any way to be notified from the objectweb site of changes in the tracker (new/fixed bugs etc)? Similarly, I notice that the ops-commits mailing list went silent in February last year - would it be difficult to revive this? It's very difficult with CVS to get a project level summary of changes otherwise :)

Adrian

Erik Bruchez wrote:
Adrian,

I think this exact same NPE was fixed yesterday. You may have some luck with a newer build.

-Erik

Adrian Baker wrote:
Ok so my attempts at using conditional actions as a workaround aren't working so well.

Attached is an example which upon executing the insert action (click on a link) throws a NullPointerException in this exception handler in org.orbeon.saxon.dom4j.NodeWrapper  because the context node is null. I guess this is the main issue, but the catch clause might also need changing to be a bit more defensive, or a null check made earlier (not totally sure if this is a Saxon code or OPS though).

    throw new IllegalArgumentException("Bad node type in dom4j! " + node.getClass() + " instance " + node.toString());

2006-06-22 18:54:27,566 ERROR org.orbeon.oxf.webapp.ProcessorService  - Exception at null, line -1, column -1
java.lang.NullPointerException
    at org.orbeon.saxon.dom4j.NodeWrapper.makeWrapper(NodeWrapper.java:98)
    at org.orbeon.saxon.dom4j.NodeWrapper.makeWrapper(NodeWrapper.java:61)
    at org.orbeon.saxon.dom4j.DocumentWrapper.wrap(DocumentWrapper.java:61)
    at org.orbeon.oxf.xforms.DocumentXPathEvaluator.evaluate(DocumentXPathEvaluator.java:49)
    at org.orbeon.oxf.xforms.XFormsInstance.evaluateXPath(XFormsInstance.java:215)
    at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:74)
    at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:173)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.runAction(XFormsContainingDocument.java:793)
    at org.orbeon.oxf.xforms.event.XFormsEventHandlerImpl.handleEvent(XFormsEventHandlerImpl.java:85)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.dispatchEvent(XFormsContainingDocument.java:729)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.interpretEvent(XFormsContainingDocument.java:447)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.executeExternalEvent(XFormsContainingDocument.java:433)
    at org.orbeon.oxf.xforms.processor.XFormsServer.executeExternalEventPrepareIfNecessary(XFormsServer.java:282)
    at org.orbeon.oxf.xforms.processor.XFormsServer.doIt(XFormsServer.java:233)

I've been able to use if on an action elsewhere, but it was on a setvalue outside of a repeat.

Adrian


Adrian Baker wrote:
I've got form using the new context & origin attributes to insert into an empty nodeset - it works well, except that it seems to be doing a prepend when it should be doing an append. Attached is an example - click on the links on the bottom left area to add new conditions to the repeat. You'll see each new condition appears at the beginning of the list, rather than the end. The relevant insert action:

    <xforms:insert context="instance('query')" nodeset="condition" origin="instance('template-condition')" />

From the example of append & prepend at http://www.w3.org/TR/xforms11/#insert-action it seems that should be inserting the new node *after* any existing nodes. Fiddling with at & position didn't seem to help.

Workaround might be to use a conditional actions (yay) so a different insert is used when there are existing conditions.

Adrian

Erik Bruchez wrote:
He he, *sometimes* we are really fast, and sometimes not as fast :-)

Let us know if this works for you.

-Erik

Larry T. Chen wrote:
Wow that was fast!  You guys are just amazing.  (How many hours do you work everyday?)  Thanks a million.  Now having the ability to insert into an empty element really completes the toolset needed to make XForms work for any situation.  I will be testing it out soon!

Larry

Erik Bruchez wrote:
Larry,

> Thanks for the quick reply.  I knew about the origin attribute on
> the insert action, but since it didn't work on an empty repeat, I
> gave up on it since I'm still forced to create a skeleton XML
> instance and merge existing data with it.  So what I really need is
> that new context attribute on the insert action so I can insert into
> an empty repeat.
>
> Having that ability will really simplify the majority of my forms
> and pipeline processing (I'm sure for a lot of other users as well
> who need to manage lists with XForms).
>
> So I'd like to put in a formal feature request to have the context
> attribute implemented.  Thanks again.

This is now implemented. In fact, I have reworked the insert action to
follow much more closely its current description in the XForms 1.1
draft. For example, you can now insert attributes as well.

I attach a simple example that shows how things work.

-Erik

------------------------------------------------------------------------


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


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
------------------------------------------------------------------------


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


------------------------------------------------------------------------


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



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



--
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: XForms 1.1 duplicate action?

Adrian Baker-2
In reply to this post by Erik Bruchez
It seems it's my day to spam the ops list :)

So, working around the prepend problem using conditional actions almost worked - here it is:

<!--
FIXME to work around an OPS bug which mistakenly prepends instead of appends when the 'context' attribute is used, we use two conditional events: one which is used to insert the first condition into a blank query,and the second which is used to append subsequent conditions. -->
<xforms:insert if="instance('query')/condition"
    nodeset="instance('query')/condition"
    origin="instance('template-condition')" />

<xforms:insert if="not(instance('query')/condition)"
    context="instance('query')" nodeset="condition"
    origin="instance('template-condition')" />

It all works fine when there is a node present - the first action fires, the second does not. However, when there are no conditions present the second event doesn't fire: nothing happens.

Debugging through, both actions are skipped because of this check:

    if (currentSingleNode == null) {
       if (XFormsServer.logger.isDebugEnabled())
          XFormsServer.logger.debug("XForms - not executing conditional action (missing context): " + actionEventName);

       return;
    }

(Should this be an exception, or logger.warn? I guess it's because the spec says an empty nodeset just means the event doesn't fire).

Attached is an example which should demonstrate the problem.

There's a workaround for the workaround :) Wrapping the problem insert in an <xforms:action> and moving the "if" up it seems to avoid the problem:

  <xforms:insert nodeset="instance('query')/condition"
      origin="instance('template-condition')"
    if="instance('query')/condition"/>
   
  <xforms:action if="not(instance('query')/condition)">
      <xforms:insert context="instance('query')"
          nodeset="condition"
        origin="instance('template-condition')"/>
   </xforms:action>

(Although the first action is still actually skipped because of the missing context rather than the 'if' evaluating to false. Technically this is correct I guess since the nodeset is empty? Same effect anyway.)

Adrian

Erik Bruchez wrote:
Adrian,

I think this exact same NPE was fixed yesterday. You may have some luck with a newer build.

-Erik

Adrian Baker wrote:
Ok so my attempts at using conditional actions as a workaround aren't working so well.

Attached is an example which upon executing the insert action (click on a link) throws a NullPointerException in this exception handler in org.orbeon.saxon.dom4j.NodeWrapper  because the context node is null. I guess this is the main issue, but the catch clause might also need changing to be a bit more defensive, or a null check made earlier (not totally sure if this is a Saxon code or OPS though).

    throw new IllegalArgumentException("Bad node type in dom4j! " + node.getClass() + " instance " + node.toString());

2006-06-22 18:54:27,566 ERROR org.orbeon.oxf.webapp.ProcessorService  - Exception at null, line -1, column -1
java.lang.NullPointerException
    at org.orbeon.saxon.dom4j.NodeWrapper.makeWrapper(NodeWrapper.java:98)
    at org.orbeon.saxon.dom4j.NodeWrapper.makeWrapper(NodeWrapper.java:61)
    at org.orbeon.saxon.dom4j.DocumentWrapper.wrap(DocumentWrapper.java:61)
    at org.orbeon.oxf.xforms.DocumentXPathEvaluator.evaluate(DocumentXPathEvaluator.java:49)
    at org.orbeon.oxf.xforms.XFormsInstance.evaluateXPath(XFormsInstance.java:215)
    at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:74)
    at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:173)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.runAction(XFormsContainingDocument.java:793)
    at org.orbeon.oxf.xforms.event.XFormsEventHandlerImpl.handleEvent(XFormsEventHandlerImpl.java:85)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.dispatchEvent(XFormsContainingDocument.java:729)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.interpretEvent(XFormsContainingDocument.java:447)
    at org.orbeon.oxf.xforms.XFormsContainingDocument.executeExternalEvent(XFormsContainingDocument.java:433)
    at org.orbeon.oxf.xforms.processor.XFormsServer.executeExternalEventPrepareIfNecessary(XFormsServer.java:282)
    at org.orbeon.oxf.xforms.processor.XFormsServer.doIt(XFormsServer.java:233)

I've been able to use if on an action elsewhere, but it was on a setvalue outside of a repeat.

Adrian


Adrian Baker wrote:
I've got form using the new context & origin attributes to insert into an empty nodeset - it works well, except that it seems to be doing a prepend when it should be doing an append. Attached is an example - click on the links on the bottom left area to add new conditions to the repeat. You'll see each new condition appears at the beginning of the list, rather than the end. The relevant insert action:

    <xforms:insert context="instance('query')" nodeset="condition" origin="instance('template-condition')" />

From the example of append & prepend at http://www.w3.org/TR/xforms11/#insert-action it seems that should be inserting the new node *after* any existing nodes. Fiddling with at & position didn't seem to help.

Workaround might be to use a conditional actions (yay) so a different insert is used when there are existing conditions.

Adrian

Erik Bruchez wrote:
He he, *sometimes* we are really fast, and sometimes not as fast :-)

Let us know if this works for you.

-Erik

Larry T. Chen wrote:
Wow that was fast!  You guys are just amazing.  (How many hours do you work everyday?)  Thanks a million.  Now having the ability to insert into an empty element really completes the toolset needed to make XForms work for any situation.  I will be testing it out soon!

Larry

Erik Bruchez wrote:
Larry,

> Thanks for the quick reply.  I knew about the origin attribute on
> the insert action, but since it didn't work on an empty repeat, I
> gave up on it since I'm still forced to create a skeleton XML
> instance and merge existing data with it.  So what I really need is
> that new context attribute on the insert action so I can insert into
> an empty repeat.
>
> Having that ability will really simplify the majority of my forms
> and pipeline processing (I'm sure for a lot of other users as well
> who need to manage lists with XForms).
>
> So I'd like to put in a formal feature request to have the context
> attribute implemented.  Thanks again.

This is now implemented. In fact, I have reworked the insert action to
follow much more closely its current description in the XForms 1.1
draft. For example, you can now insert attributes as well.

I attach a simple example that shows how things work.

-Erik

------------------------------------------------------------------------


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


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
------------------------------------------------------------------------


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


------------------------------------------------------------------------


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



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


badRepeatAdd.xhtml (48K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XForms 1.1 duplicate action?

Erik Bruchez
Administrator
In reply to this post by Adrian Baker-2
Adrian,

This bug is now fixed, and you should no longer need a workaround!

http://forge.objectweb.org/tracker/index.php?func=detail&aid=305569&group_id=168&atid=350207

Let us know if you still have issue with it.

-Erik

Adrian Baker wrote:

> I've got form using the new context & origin attributes to insert into
> an empty nodeset - it works well, except that it seems to be doing a
> prepend when it should be doing an append. Attached is an example -
> click on the links on the bottom left area to add new conditions to the
> repeat. You'll see each new condition appears at the beginning of the
> list, rather than the end. The relevant insert action:
>
>     <xforms:insert context="instance('query')" nodeset="condition"
> origin="instance('template-condition')" />
>
>  From the example of append & prepend at
> http://www.w3.org/TR/xforms11/#insert-action it seems that should be
> inserting the new node *after* any existing nodes. Fiddling with at &
> position didn't seem to help.
>
> Workaround might be to use a conditional actions (yay) so a different
> insert is used when there are existing conditions.
>
> Adrian
--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: XForms 1.1 duplicate action?

Erik Bruchez
Administrator
In reply to this post by Adrian Baker-2
Adrian Baker wrote:

> It seems it's my day to spam the ops list :)
>
> So, working around the prepend problem using conditional actions almost
> worked - here it is:
>
> <!--
> FIXME to work around an OPS bug which mistakenly prepends instead of
> appends when the 'context' attribute is used, we use two conditional
> events: one which is used to insert the first condition into a blank
> query,and the second which is used to append subsequent conditions. -->
> <xforms:insert if="instance('query')/condition"
>     nodeset="instance('query')/condition"
>     origin="instance('template-condition')" />
>
> <xforms:insert if="not(instance('query')/condition)"
>     context="instance('query')" nodeset="condition"
>     origin="instance('template-condition')" />
>
> It all works fine when there is a node present - the first action fires,
> the second does not. However, when there are no conditions present the
> second event doesn't fire: nothing happens.
>
> Debugging through, both actions are skipped because of this check:
>
>     if (currentSingleNode == null) {
>        if (XFormsServer.logger.isDebugEnabled())
>           XFormsServer.logger.debug("XForms - not executing conditional
> action (missing context): " + actionEventName);
>
>        return;
>     }
>
> (Should this be an exception, or logger.warn? I guess it's because the
> spec says an empty nodeset just means the event doesn't fire).
Well, this ambiguous in the current XForms 1.1 draft, but in fact even
before you noted this, I mentioned it in the private XForms WG
mailing-list, and we believe that @if should evaluate within the
overloaded context (i.e., within @context).

Currently, we evaluate it within @nodeset (which itself evaluates within
@context). If @nodeset returns an empty node-set, then there is no more
context for the execution of @if, which causes the condition to fail, as
you noticed.

I have entered a bug to track this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=305597&group_id=168&atid=350207

Great catch :-)

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: XForms 1.1 duplicate action?

Alessandro  Vernet
Administrator
In reply to this post by Adrian Baker-2
On 6/22/06, Adrian Baker <[hidden email]> wrote:
>
>  Great, thanks - yes with an update the exception has gone. I still have
> another issue, which I'll follow up on shortly, but is there any way to be
> notified from the objectweb site of changes in the tracker (new/fixed bugs
> etc)? Similarly, I notice that the ops-commits mailing list went silent in
> February last year - would it be difficult to revive this? It's very
> difficult with CVS to get a project level summary of changes otherwise :)

Hi Adrian,

Makes sense. I remember we disabled that because nobody was subscribed
to the list anymore. We'll re-enable it and also create a RSS or Atom
feed for CVS checkins. This is the corresponding entry in the tracker:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=305628&group_id=168&atid=350207

Alex
--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet