18 Jan 17:53
Re: Does the required attribute work on a bind?
Abhishek Goel <abhishek@...> writes:
>
>
> I am new to xforms/apogee and haven't been able to find a resolution to a
seemigly simple problem. I downloaded the three packages
(org.nuxeo.xforms.core/ui/ui.editors) and am currently trying to learn by
modifying the given examples.
>
>
> In org.nuxeo.xforms.ui.test/Example1.java, I replaced the line
>
> XInputSource src = new URLInputSource(Example1.class.getResource(
> "example1.xhtml"));
> with
> XInputSource src = new URLInputSource(Example1.class
> .getResource("document.xhtml"));
> and commented out the lines (not inclusive) between
> final UIForm uiForm = new SWTBuilder().build(form, shell); and
> shell.setBounds(10, 10, 400, 200);
> As a result I was able to see the SWT form generated by document.xhtml. I then
tried to submit the form by leaving the "title" field empty, but got an
exception. This indicated that the minLength validation in
> document.xsd works. However, when I removed the minLength and maxLength
validation and again tried to submit the form leaving the "title" field empty, I
expected to get an exception but did not get one. I was expecting an exception
because of the line
>
> <bind nodeset="/document/metadata/title"
> id="title" required=
> "true()"/>
> inside document.xhtml.
> So, my question: Is the "required" validation feature not been implemented? If
it has been can someone please guide me as to how do I validate a field to
ensure that the user enters a value.
>
> Thanks.
> Abhishek Goel
>
>
>
>
>
> _______________________________________________
> Apogee mailing list
> Apogee@...
> http://lists.nuxeo.com/mailman/listinfo/apogee
>
My own response:
Never mind. I realized that its just not implemented yet. The developer's guide
Section 3 (XForms Implementation), in its 3rd point says "XForms types and
constraints are not implemented. The only way to define types and constraints on
elements values is XML Schema". I guess I should focus more on reading the
guides than jumping straight into coding. I think that the required constraint
is one of the most commonly used constraints so I'm going to try and implement
it and see if I can contribute to the project.
RSS Feed