How to use a schema with xForms NG

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

How to use a schema with xForms NG

c.harder
At first, thanks for all help. ;-))

Now I like to use a schema.xsd for validation (Maybe there is a better way?).
I have extended Erics Hello4 Example (some posts ago), which shows page flow with xforms NG.

The initial-instance.xml looks like that:

<myform>
  <action />
  <first-name />
  <age />
</myform>

action and first-name should be type of string. age type of integer/int.
So schema.xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="myform">
    <xs:complexType>
      <xs:sequence>
        <xs:element
          name="action"
          type="xs:string" />
        <xs:element
          name="first-name"
          type="xs:string" />
        <xs:element
          name="age"
          type="xs:int" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Now I tried this in the head of ask-name-view.xhtml:

<xforms:model schema="oxf:/dvz/schema.xsd">
...
</xforms:model>

Now I see an exclamation mark on input field "age". If I write an integer everything is fine and the mark is gone.
But now the "next" Button is not working anymore.
Where is my mistake?



--
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: How to use a schema with xForms NG

Erik Bruchez
Administrator
That's because your XForms instance is now invalid. The "Next" button
causes an xforms:send action to be performed, which starts an XForms
submission, but the submission is interrupted because only a valid
(sub)instance can be submitted.

-Erik

[hidden email] wrote:

> At first, thanks for all help. ;-))
>
> Now I like to use a schema.xsd for validation (Maybe there is a better way?).
> I have extended Erics Hello4 Example (some posts ago), which shows page flow with xforms NG.
>
> The initial-instance.xml looks like that:
>
> <myform>
>   <action />
>   <first-name />
>   <age />
> </myform>
>
> action and first-name should be type of string. age type of integer/int.
> So schema.xsd:
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:element name="myform">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element
>           name="action"
>           type="xs:string" />
>         <xs:element
>           name="first-name"
>           type="xs:string" />
>         <xs:element
>           name="age"
>           type="xs:int" />
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
>
> Now I tried this in the head of ask-name-view.xhtml:
>
> <xforms:model schema="oxf:/dvz/schema.xsd">
> ...
> </xforms:model>
>
> Now I see an exclamation mark on input field "age". If I write an integer everything is fine and the mark is gone.
> But now the "next" Button is not working anymore.
> Where is my mistake?


--
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: How to use a schema with xForms NG

Erik Bruchez
Administrator
I forgot to say: this is true whether the instance is validated with a
schema or with "constraint" or "type" properties.

-Erik

Erik Bruchez wrote:

> That's because your XForms instance is now invalid. The "Next" button
> causes an xforms:send action to be performed, which starts an XForms
> submission, but the submission is interrupted because only a valid
> (sub)instance can be submitted.
>
> -Erik
>
> [hidden email] wrote:
>
>> At first, thanks for all help. ;-))
>>
>> Now I like to use a schema.xsd for validation (Maybe there is a better
>> way?). I have extended Erics Hello4 Example (some posts ago), which
>> shows page flow with xforms NG.
>>
>> The initial-instance.xml looks like that:
>>
>> <myform>
>>   <action />
>>   <first-name />
>>   <age />
>> </myform>
>>
>> action and first-name should be type of string. age type of
>> integer/int. So schema.xsd:
>>
>> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>   <xs:element name="myform">
>>     <xs:complexType>
>>       <xs:sequence>
>>         <xs:element
>>           name="action"
>>           type="xs:string" />
>>         <xs:element
>>           name="first-name"
>>           type="xs:string" />
>>         <xs:element
>>           name="age"
>>           type="xs:int" />
>>       </xs:sequence>
>>     </xs:complexType>
>>   </xs:element>
>> </xs:schema>
>>
>> Now I tried this in the head of ask-name-view.xhtml:
>>
>> <xforms:model schema="oxf:/dvz/schema.xsd">
>> ...
>> </xforms:model>
>>
>> Now I see an exclamation mark on input field "age". If I write an
>> integer everything is fine and the mark is gone.
>> But now the "next" Button is not working anymore. Where is my mistake?



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