bizdoc2 example - form validation

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

bizdoc2 example - form validation

Tanya Gray (Oxford)
Hello,

I am working with the bizdoc2 example. Again, as a learning process I have modified files by:
-- modifying the  xsd file provided
-- modifying the empty instance and xforms input fields

This is all working fine. However, using the save/back button causes a validation error:
Submission failed! Please correct errors first

I have tried to traced the save/back action, but have been unable to identify where the validation occurs.

I would like to know:
-- what is validating the form input values?
-- is there something else I need to modify in the bizdoc2/bizdoc application, to reflect a change in .xsd file and form empty instance file?


thank you
Tanya




--
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: bizdoc2 example - form validation

Erik Bruchez
Administrator
Tanya Gray wrote:

> Hello,
>
> I am working with the bizdoc2 example. Again, as a learning process I have modified files by:
> -- modifying the  xsd file provided
> -- modifying the empty instance and xforms input fields
>
> This is all working fine. However, using the save/back button causes a validation error:
> Submission failed! Please correct errors first
>
> I have tried to traced the save/back action, but have been unable to identify where the validation occurs.
>
> I would like to know:
> -- what is validating the form input values?
> -- is there something else I need to modify in the bizdoc2/bizdoc application, to reflect a change in .xsd file and form empty instance file?
For reference, when performing an XForms submission, a whole lot of
things happen. The reference can be read here:

   http://www.w3.org/TR/2005/PER-xforms-20051006/slice11.html

In particular, nodes are validated (schema and binds) and required
fields (binds) are checked. If something bad happens, then an
xforms-submit-error event is sent, otherwise an xforms-submit-done is
sent. In the BizDoc NG example, "Submission failed!" is displayed upon
catching the xforms-submit-error event.

If you modify the XML Schema, you probably have to modify
bizdoc/schema/empty-instance.xml as well, and/or of course, if you are
retrieving documents from the eXist database, and those no longer pass
schema validation, you have to modify them as well.

Note that in beta 3, if the instance is not valid upon submission, we
write it out to the console with some xxforms:* attributes annotations.
So you should be able to examine that document and check what is not
valid in the instance.

-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: bizdoc2 example - form validation

Tanya Gray (Oxford)
In reply to this post by Tanya Gray (Oxford)
Hello

I have encountered a problem with the form validation:

Background
--------------

ops v 3 beta 3
modifying files in the bizdoc2/bizdoc example

objective
-----------
To generate an input form using:
one xsl file,
one xsd file, and
multiple empty instance files.

Also use <xform:if test="boolean(xml element)"> to display input field *table row* only if element is present in the empty instance file. (The beta 3 version is working as described in earlier email, ie not dipslaying input field when element is absent from empty instance file -- however, I also need to remove the corresponding table row from the input field.)

Problem encountered
-------------------------

If I delete an element from the empty instance xml file, then the form validation goes awry, in that all the input fields below the element removed, now have a validation alert image displayed.

I have found that if the element is removed from the xml schema file as well as the xml empty instance file, then all works fine. However, I would like to use just a single xml schema file, hence my problem.

Question
-----------
Does anyone know the reason for the behaviour described above, and/or a possible solution?

thank you for any help
Tanya










--
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: bizdoc2 example - form validation

Erik Bruchez
Administrator
Tanya Gray wrote:
 > Hello
 >
 > I have encountered a problem with the form validation:
 >
 > Background
 > --------------
 >
 > ops v 3 beta 3
 > modifying files in the bizdoc2/bizdoc example
 >
 > objective
 > -----------
 > To generate an input form using:
 > one xsl file,
 > one xsd file, and
 > multiple empty instance files.
 >
 > Also use <xform:if test="boolean(xml element)"> to display input
 > field *table row* only if element is present in the empty instance
 > file. (The beta 3 version is working as described in earlier email,
 > ie not dipslaying input field when element is absent from empty
 > instance file -- however, I also need to remove the corresponding
 > table row from the input field.)
 >
 > Problem encountered
 > -------------------------
 >
 > If I delete an element from the empty instance xml file, then the
 > form validation goes awry, in that all the input fields below the
 > element removed, now have a validation alert image displayed.
 >
 > I have found that if the element is removed from the xml schema file
 > as well as the xml empty instance file, then all works
 > fine. However, I would like to use just a single xml schema file,
 > hence my problem.
 >
 > Question
 > -----------
 > Does anyone know the reason for the behaviour described above,
 > and/or a possible solution?

I did reproduce that. I guess this occurs because of the way OPS
applies the schema to the XForms instance. claim-schema.xsd validates
the element called claim:claim. When doing so, as soon as the first
error is encountered (missing element), subsequent elements are marked
as invalid as well by the schema validator.

Now is this the expected behavior, I have some doubts, and we will
have to check ;-) Remember, XML schema validation was not well defined
at all in the initial XForms spec. The errata and second edition have
now cleared-up some aspects, but this one has to be checked. I have
entered a bug to track this:

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

But one thing you can do is make it so that the schema does not
validate the structure of the document, but only validate leaves,
i.e. create top-level types such as claim:title-prefix,
claim:last-name, etc.

-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: bizdoc2 example - form validation

Tanya Gray (Oxford)
In reply to this post by Tanya Gray (Oxford)
Hi Erik,

thank you for your explanation.

Just a quick question regarding your suggestion:
"make it so that the schema does not validate the structure of the document, but only validate leaves, i.e. create top-level types such as claim:title-prefix, claim:last-name, etc."

Please is it possible to explain how to implement the suggestion above - I imagine this involves changing an xforms validation config file - but I am unable to locate the relevant file(s).

thank you v much
Tanya







I did reproduce that. I guess this occurs because of the way OPS
applies the schema to the XForms instance. claim-schema.xsd validates
the element called claim:claim. When doing so, as soon as the first
error is encountered (missing element), subsequent elements are marked
as invalid as well by the schema validator.

Now is this the expected behavior, I have some doubts, and we will
have to check ;-) Remember, XML schema validation was not well defined
at all in the initial XForms spec. The errata and second edition have
now cleared-up some aspects, but this one has to be checked. I have
entered a bug to track this:

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

But one thing you can do is make it so that the schema does not
validate the structure of the document, but only validate leaves,
i.e. create top-level types such as claim:title-prefix,
claim:last-name, etc.

-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: bizdoc2 example - form validation

Erik Bruchez
Administrator
Tanya,

There is no such thing as "an xforms validation config file". In
XForms, you validate in an XForms model using either xforms:bind
and/or imported XML schemas. The BizDoc examples strictly validate
using the imported claim-schema.xsd, which I was suggesting you
modify. Right now at the top-level of that schema you have:

<xs:element name="claim">
   ...

This not only validates "leaves" of the XForms instance, but also
validates the structure of the document, which in your case appears to
cause problems.

My suggestion just consisted in modifying claim-schema.xsd to no
longer validate claim:claim, but to validate leaves, by creating
top-level types such as:

<xs:element name="street-name">
   ...

<xs:element name="first-name">
   ...

Etc.

-Erik

Tanya Gray wrote:
 > Hi Erik,
 >
 > thank you for your explanation.
 >
 > Just a quick question regarding your suggestion:
 > "make it so that the schema does not validate the structure of the
 > document, but only validate leaves, i.e. create top-level types such
 > as claim:title-prefix, claim:last-name, etc."
 >
 > Please is it possible to explain how to implement the suggestion
 > above - I imagine this involves changing an xforms validation config
 > file - but I am unable to locate the relevant file(s).
 >
 > thank you v much
 > Tanya
 >
 >
 >
 >
 >
 >
 >
 > I did reproduce that. I guess this occurs because of the way OPS
 > applies the schema to the XForms instance. claim-schema.xsd validates
 > the element called claim:claim. When doing so, as soon as the first
 > error is encountered (missing element), subsequent elements are marked
 > as invalid as well by the schema validator.
 >
 > Now is this the expected behavior, I have some doubts, and we will
 > have to check ;-) Remember, XML schema validation was not well defined
 > at all in the initial XForms spec. The errata and second edition have
 > now cleared-up some aspects, but this one has to be checked. I have
 > entered a bug to track this:
 >
 >
https://forge.objectweb.org/tracker/index.php?func=detail&aid=304152&group_id=168&atid=350207
 >
 > But one thing you can do is make it so that the schema does not
 > validate the structure of the document, but only validate leaves,
 > i.e. create top-level types such as claim:title-prefix,
 > claim:last-name, etc.
 >
 > -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