trouble using classic xforms with ops beta 3

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

trouble using classic xforms with ops beta 3

Alexander Žaťko
Since I upgraded to OPS beta 3 I noticed that the "required" attribute
of the "bind" element is ignored. However, a "constraint" attribute
with value "string-length(.) > 0" is honored by the xforms engine.

The page-flow.xpl for that page looks like this:

     <page id="invoice" path-info="/edit"            xforms="model.xml"  
          model="ship-notice.xpl"       view="ship-notice-view.xsl">

The  relevant bind model node looks like this:

  <xforms:bind id="b_invoicenumber" nodeset="/invoicenumber"
constraint="string-length(.) &gt; 0" required="true()"/>

The form validation logic seems also weird. It looks like OPS classic
xforms engine will validate the form after "ship-notice.xpl" processes
it, which in my case inserts the form with potentially invalid data
into db.

Lastly, the model is validated upon loading the form into browser,
which makes form field validation useless because a blank form can not
be displayed without xforms alert messages if some fields in it are
defined as required.

Maybe the way I put this thing together is wrong?

Thanks

A.




--
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: trouble using classic xforms with ops beta 3

Erik Bruchez
Administrator
Alexander Zatko wrote:
 > Since I upgraded to OPS beta 3 I noticed that the "required" attribute
 > of the "bind" element is ignored. However, a "constraint" attribute with
 > value "string-length(.) &gt; 0" is honored by the xforms engine.

The way "required" was handled in 2.8 was actually not correct. It has
turned out, as has been made clear(er) by the latest XForms 1.0
errata, that:

o The "required" property does not impact the "valid" property:
   "valid" and "required" are separate properties.

o Upon XForms submission, if a node is required but empty, submission
   will fail, in the same way that it fails if a node is invalid.

o It is up to the implementation to decide how the UI reflects the
   fact that a bound XForms control is valid and/or required, with a
   preference for using CSS styles.

This behavior has been fixed in OPS 3.0, and this may explain the
issue you are encountering. This is BTW documented here under section
4.2:

   http://www.orbeon.com/ops/doc/home-changes-30

However, we should make sure that we can still use the XForms classic
engine in a way that makes sense in OPS 3.0, and that required fields
are also marked up by the UI. If I understand well, this is what you
are looking for. I entered a bug to track this:

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

In the meanwhile, you can use the "valid" model item property, as you
suggest above, with the "constraint" attribute.

 > The page-flow.xpl for that page looks like this:
 >
 >     <page id="invoice" path-info="/edit"            xforms="model.xml"
 >          model="ship-notice.xpl"       view="ship-notice-view.xsl">
 >
 > The  relevant bind model node looks like this:
 >
 >  <xforms:bind id="b_invoicenumber" nodeset="/invoicenumber"
 > constraint="string-length(.) &gt; 0" required="true()"/>
 >
 > The form validation logic seems also weird. It looks like OPS
 > classic xforms engine will validate the form after "ship-notice.xpl"
 > processes it, which in my case inserts the form with potentially
 > invalid data into db.

The XForms Classic engine validates the submitted XForms instance
before providing it to the page model (and page view), and adds
annotations of the form "xxforms:valid", etc. But this should have not
changed since 2.8. What do you mean that you have potentially invalid
data?

 > Lastly, the model is validated upon loading the form into browser,
 > which makes form field validation useless because a blank form can
 > not be displayed without xforms alert messages if some fields in it
 > are defined as required.

I wouldn't say that this makes XForms validation useless, however
certaily it is desirable in some cases NOT to show validation errors
upon first display of the page. Do do this in 2.8, you can add a
special attribute on the xforms:group element, as done in the BizDoc
example:

<xforms:group ref="/form"
xxforms:show-errors="{doc('input:instance')/form/show-errors = 'true'}">

 > Maybe the way I put this thing together is wrong?

No, I think you are putting things together correctly, but I have a
few remarks:

o If behaviors have changed between XForms Classic between 2.8 and
   3.0, beyond the known incompatible changes listed in the doc, please
   let us know.

o You can also use the new XForms engine, wich provides much more
   functionality and is going to be better supported.

-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
Reply | Threaded
Open this post in threaded view
|

Re: trouble using classic xforms with ops beta 3

Alexander Žaťko
Thanks for taking time to answer my questions.

I will try to recode the page to use the AJAX-based Xforms engine. The
issue about "invalid data" I mention below is probably related to the
fact that I do not have my form responses processed correctly. I will
first recode the page and see if I get different results.

Alex.

On Sep 22, 2005, at 7:31 PM, Erik Bruchez wrote:

> Alexander Zatko wrote:
> > Since I upgraded to OPS beta 3 I noticed that the "required"
> attribute
> > of the "bind" element is ignored. However, a "constraint" attribute
> with
> > value "string-length(.) &gt; 0" is honored by the xforms engine.
>
> The way "required" was handled in 2.8 was actually not correct. It has
> turned out, as has been made clear(er) by the latest XForms 1.0
> errata, that:
>
> o The "required" property does not impact the "valid" property:
>   "valid" and "required" are separate properties.
>
> o Upon XForms submission, if a node is required but empty, submission
>   will fail, in the same way that it fails if a node is invalid.
>
> o It is up to the implementation to decide how the UI reflects the
>   fact that a bound XForms control is valid and/or required, with a
>   preference for using CSS styles.
>
> This behavior has been fixed in OPS 3.0, and this may explain the
> issue you are encountering. This is BTW documented here under section
> 4.2:
>
>   http://www.orbeon.com/ops/doc/home-changes-30
>
> However, we should make sure that we can still use the XForms classic
> engine in a way that makes sense in OPS 3.0, and that required fields
> are also marked up by the UI. If I understand well, this is what you
> are looking for. I entered a bug to track this:
>
> http://forge.objectweb.org/tracker/index.php?group_id=168&atid=350207
>
> In the meanwhile, you can use the "valid" model item property, as you
> suggest above, with the "constraint" attribute.
>
> > The page-flow.xpl for that page looks like this:
> >
> >     <page id="invoice" path-info="/edit"            
> xforms="model.xml"
> >          model="ship-notice.xpl"       view="ship-notice-view.xsl">
> >
> > The  relevant bind model node looks like this:
> >
> >  <xforms:bind id="b_invoicenumber" nodeset="/invoicenumber"
> > constraint="string-length(.) &gt; 0" required="true()"/>
> >
> > The form validation logic seems also weird. It looks like OPS
> > classic xforms engine will validate the form after "ship-notice.xpl"
> > processes it, which in my case inserts the form with potentially
> > invalid data into db.
>
> The XForms Classic engine validates the submitted XForms instance
> before providing it to the page model (and page view), and adds
> annotations of the form "xxforms:valid", etc. But this should have not
> changed since 2.8. What do you mean that you have potentially invalid
> data?
>
> > Lastly, the model is validated upon loading the form into browser,
> > which makes form field validation useless because a blank form can
> > not be displayed without xforms alert messages if some fields in it
> > are defined as required.
>
> I wouldn't say that this makes XForms validation useless, however
> certaily it is desirable in some cases NOT to show validation errors
> upon first display of the page. Do do this in 2.8, you can add a
> special attribute on the xforms:group element, as done in the BizDoc
> example:
>
> <xforms:group ref="/form"
> xxforms:show-errors="{doc('input:instance')/form/show-errors =
> 'true'}">
>
> > Maybe the way I put this thing together is wrong?
>
> No, I think you are putting things together correctly, but I have a
> few remarks:
>
> o If behaviors have changed between XForms Classic between 2.8 and
>   3.0, beyond the known incompatible changes listed in the doc, please
>   let us know.
>
> o You can also use the new XForms engine, wich provides much more
>   functionality and is going to be better supported.
>
> -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