Hi,
I am working on integrating custom components into the form builder. I have created some custom xbl controls that contains one or more value(s) in the local instance that must all be validated against a xsd schema. The control is working fine, I can insert inner xml to the outer binding to provide multiple value support for a single control. The problem is that I am struggling to validate the data in the local instance before inserting it into the outer binding. For example, below is the local instance that contains two values: a weight in lbs and oz (both values would be presented to the user). <rpm-type type="rpm-weight"> <rpm-value type ="rpm-weight-lbs"></rpm-value> <rpm-value type ="rpm-weight-oz" ></rpm-value> </rpm-type> Those two values above would need to be validated against two different custom types. For example, lbs could be a positive integer between 1 and 500 and oz between 1 and 100. I have tried a few things but could not make anything work: -Validating with "castable as custom-type" using the same approach as the fields-date control with a <is-valid> element on the local instance. -Binding the local instance to "custom-type" In both scenarios, I get a "type not found" error even if I upload it to the form builder. I have seen a similar post that seem to say that it is not possible to do so but the post did not provide alot of details so it is hard for me to figure out if the problem was exactly the same or not. Here is the old post: http://orbeon-forms-ops-users.24843.n4.nabble.com/Custom-XML-Schema-simpleType-td27873.html Now that I explained the problem, below are my questions. -Why am I getting a "type not found" error? Since it is present in the document, I don't understand why. -Is it possible to include an xsd schema directly in the xbl component? If so, how? -Am I trying to do something that is not possible? How to achieve validation of the local instance values? -I am afraid that I will have to validate with xpath constraints. I really hope that I will not have to go that route since it will be alot more work because I would have to manually copy the constraint of each xsd type each time a change occur in the schema. I would be ready to accept that solution but only as last resort. Thanks. |
Administrator
|
Micael,
What you are doing is very similar to what Form Builder sections templates do.It's fair to say that we could improve support in Orbeon Forms for such compound controls. > -Why am I getting a "type not found" error? Since it is present in the > document, I don't understand why. The types imported by schema are only available to the model in which they are imported. That might be the problem. > -Is it possible to include an xsd schema directly in the xbl component? If > so, how? You can inline it just under the xforms:model element. That's what Form Builder does when you import a schema. But you should also be able to load it via xforms:model/@schema. > -Am I trying to do something that is not possible? How to achieve validation > of the local instance values? No, that should work! What won't work is propagating validity to the main instance. Only your XBL control's local instance and the local controls bound to it will be marked as invalid. This is also the case with section templates. But the controls being invalid are enough to cause errors to show in the error summary and to prevent saving invalid data. -Erik > -I am afraid that I will have to validate with xpath constraints. I really > hope that I will not have to go that route since it will be alot more work > because I would have to manually copy the constraint of each xsd type each > time a change occur in the schema. I would be ready to accept that solution > but only as last resort. -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |