input forms aware of schema defined types

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

input forms aware of schema defined types

john wright-24
Hi,
I've been looking around at custom xforms and xbl extensions but I
don't think I've seen an explanation of how (as a mozilla extension or
straight xforms) to do this.

Say I have a simple complex type like
   <xs:complexType name="ci">
     <xs:sequence>
       <xs:element name="r" type="xs:float" />
       <xs:element name="i" type="xs:float" />
     </xs:sequence>
   </xs:complexType>

in an instance
like
<ci>
 <r>1</r>
 <i>2</i>
</ci>
and then I want to reference it in an input control:
<input ref="myinstance/ci"><label="Complex input:"></input>
and I want it to appear as
Complex input: [1]+[2]i

without any additional information in the xforms markup. Basically, I
want the input to be aware of schema defined types and have an xbl
binding to them to describe how the input should appear.

I have seen ways to do form display bindings with css classes and
media types but I don't want to add anything to the input block just
have it be aware user defined types and display as defined elsewhere.

Any ideas or suggestions? This would really be helpful in building up
a set of type aware widgets that would make building forms a lot more
modular. And if I decided to change the type or extend a type I
wouldn't have to change the instance or form data to change the
appearance and structure of the form.

thanks.
-john
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: input forms aware of schema defined types

Aaron Reed
Hi John,

Did you read and try this?
https://developer.mozilla.org/en/XForms/Custom_Controls

All of the Mozilla XForms controls are done this way and I don't see why
it wouldn't work for what you want to do.

--Aaron

john wright wrote:

> Hi,
> I've been looking around at custom xforms and xbl extensions but I
> don't think I've seen an explanation of how (as a mozilla extension or
> straight xforms) to do this.
>
> Say I have a simple complex type like
>     <xs:complexType name="ci">
>       <xs:sequence>
>         <xs:element name="r" type="xs:float" />
>         <xs:element name="i" type="xs:float" />
>       </xs:sequence>
>     </xs:complexType>
>
> in an instance
> like
> <ci>
>   <r>1</r>
>   <i>2</i>
> </ci>
> and then I want to reference it in an input control:
> <input ref="myinstance/ci"><label="Complex input:"></input>
> and I want it to appear as
> Complex input: [1]+[2]i
>
> without any additional information in the xforms markup. Basically, I
> want the input to be aware of schema defined types and have an xbl
> binding to them to describe how the input should appear.
>
> I have seen ways to do form display bindings with css classes and
> media types but I don't want to add anything to the input block just
> have it be aware user defined types and display as defined elsewhere.
>
> Any ideas or suggestions? This would really be helpful in building up
> a set of type aware widgets that would make building forms a lot more
> modular. And if I decided to change the type or extend a type I
> wouldn't have to change the instance or form data to change the
> appearance and structure of the form.
>
> thanks.
> -john

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: input forms aware of schema defined types

john wright-24
Thanks Aaron,
yes I did look at that, but it doesn't quite do what I want. For
example, you have to specify in the output element the mediatype
attribute to bring in all the custom control scripting. What I want is
for the output element to know that curimg is of a type defined in a
schema. For example, if I have an input element for a referenced
element in an instance that is of type xs:date, xforms automatically
gives me a calendar, I don't have to specify any attribute in the
input element. I want to be able to do the same for user schema
defined types as in my example. I can see how with the example you
referred to I could do this by adding say a class attribute to trigger
the xbl through css but I have reasons for not wanting to do this. For
example creating a list of input controls from a list of different
datatypes in an instance but not knowing beforehand what's in that
instance.

As I said, Xforms already does this for it's internal datatypes, I
just want to extend that functionality with my own datatypes using the
same syntax. Is that any clearer? Or am I missing something obvious on
how this could be done?

-john


On Jan 11, 2:35 pm, Aaron Reed <[hidden email]> wrote:

> Hi John,
>
> Did you read and try this?https://developer.mozilla.org/en/XForms/Custom_Controls
>
> All of the Mozilla XForms controls are done this way and I don't see why
> it wouldn't work for what you want to do.
>
> --Aaron
>
>
>
> john wright wrote:
> > Hi,
> > I've been looking around at custom xforms and xbl extensions but I
> > don't think I've seen an explanation of how (as a mozilla extension or
> > straight xforms) to do this.
>
> > Say I have a simple complex type like
> >     <xs:complexType name="ci">
> >       <xs:sequence>
> >         <xs:element name="r" type="xs:float" />
> >         <xs:element name="i" type="xs:float" />
> >       </xs:sequence>
> >     </xs:complexType>
>
> > in an instance
> > like
> > <ci>
> >   <r>1</r>
> >   <i>2</i>
> > </ci>
> > and then I want to reference it in an input control:
> > <input ref="myinstance/ci"><label="Complex input:"></input>
> > and I want it to appear as
> > Complex input: [1]+[2]i
>
> > without any additional information in the xforms markup. Basically, I
> > want the input to be aware of schema defined types and have an xbl
> > binding to them to describe how the input should appear.
>
> > I have seen ways to do form display bindings with css classes and
> > media types but I don't want to add anything to the input block just
> > have it be aware user defined types and display as defined elsewhere.
>
> > Any ideas or suggestions? This would really be helpful in building up
> > a set of type aware widgets that would make building forms a lot more
> > modular. And if I decided to change the type or extend a type I
> > wouldn't have to change the instance or form data to change the
> > appearance and structure of the form.
>
> > thanks.
> > -john

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: input forms aware of schema defined types

Philipp Wagner-4
Hey John,

Am 12.01.2010 03:43, john wright wrote:
> As I said, Xforms already does this for it's internal datatypes, I
> just want to extend that functionality with my own datatypes using the
> same syntax. Is that any clearer? Or am I missing something obvious on
> how this could be done?

XForms only gives you controls for its own data types. It is not
possible to say "an element of myNamespace:complexNumber should be
rendered as two input boxes and some labels" [1] While it might be
possible to do that in some XForms processors (it is in Mozilla XForms
using custom XBL bindings), I would recommend not to use these processor
specific solutions, but do some server-side preprocessing of your
XForms, resulting in valid XForms markup.

For example:

>>> Say I have a simple complex type like
>>>     <xs:complexType name="ci">
>>>       <xs:sequence>
>>>         <xs:element name="r" type="xs:float" />
>>>         <xs:element name="i" type="xs:float" />
>>>       </xs:sequence>
>>>     </xs:complexType>
>>
>>> in an instance
>>> like
>>> <ci>
>>>   <r>1</r>
>>>   <i>2</i>
>>> </ci>


If you use XForms markup that looks like that:

<myNamespace:complexNumberInput ref="myinstance/ci">
  <xf:label="Complex input:">
</myNamespace:complexNumberInput>

Then you can use XSLT to replace all myNamespace:complexNumberInput with
the "real" XForms markup, e.g.

<xf:label="Complex input:">
<xf:input ref="myinstance/ci/r"> + <xf:input ref="myinstance/ci/i">i

If you do not want to use your own tag names, you might be able to do
preprocessing based on the PSVI of your instance and get the schema
information from there (you can use Xerces or Saxon-SA to get that
information).

The benefit of this preprocessing solution is that it works with every
XForms processor in case you want to migrate to another solution or
target other devices.

HTH

Philipp


[1] There were some attempts, see
http://xformsinstitute.com/essentials/browse/ch11.php for details, but
e.g. the mustUnderstand attribute has been removed from XForms 1.1.

>
> -john
>
>
> On Jan 11, 2:35 pm, Aaron Reed <[hidden email]> wrote:
>> Hi John,
>>
>> Did you read and try this?https://developer.mozilla.org/en/XForms/Custom_Controls
>>
>> All of the Mozilla XForms controls are done this way and I don't see why
>> it wouldn't work for what you want to do.
>>
>> --Aaron
>>
>>
>>
>> john wright wrote:
>>> Hi,
>>> I've been looking around at custom xforms and xbl extensions but I
>>> don't think I've seen an explanation of how (as a mozilla extension or
>>> straight xforms) to do this.
>>
>>> Say I have a simple complex type like
>>>     <xs:complexType name="ci">
>>>       <xs:sequence>
>>>         <xs:element name="r" type="xs:float" />
>>>         <xs:element name="i" type="xs:float" />
>>>       </xs:sequence>
>>>     </xs:complexType>
>>
>>> in an instance
>>> like
>>> <ci>
>>>   <r>1</r>
>>>   <i>2</i>
>>> </ci>
>>> and then I want to reference it in an input control:
>>> <input ref="myinstance/ci"><label="Complex input:"></input>
>>> and I want it to appear as
>>> Complex input: [1]+[2]i
>>
>>> without any additional information in the xforms markup. Basically, I
>>> want the input to be aware of schema defined types and have an xbl
>>> binding to them to describe how the input should appear.
>>
>>> I have seen ways to do form display bindings with css classes and
>>> media types but I don't want to add anything to the input block just
>>> have it be aware user defined types and display as defined elsewhere.
>>
>>> Any ideas or suggestions? This would really be helpful in building up
>>> a set of type aware widgets that would make building forms a lot more
>>> modular. And if I decided to change the type or extend a type I
>>> wouldn't have to change the instance or form data to change the
>>> appearance and structure of the form.
>>
>>> thanks.
>>> -john
>

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: input forms aware of schema defined types

Aaron Reed
I believe that what you want to do should be possible in Mozilla XForms.
  But like Philipp says, that will only work in Mozilla.  His solution
is more cross platform.

--Aaron


Philipp Wagner wrote:

> Hey John,
>
> Am 12.01.2010 03:43, john wright wrote:
>> As I said, Xforms already does this for it's internal datatypes, I
>> just want to extend that functionality with my own datatypes using the
>> same syntax. Is that any clearer? Or am I missing something obvious on
>> how this could be done?
>
> XForms only gives you controls for its own data types. It is not
> possible to say "an element of myNamespace:complexNumber should be
> rendered as two input boxes and some labels" [1] While it might be
> possible to do that in some XForms processors (it is in Mozilla XForms
> using custom XBL bindings), I would recommend not to use these processor
> specific solutions, but do some server-side preprocessing of your
> XForms, resulting in valid XForms markup.
>
> For example:
>
>>>> Say I have a simple complex type like
>>>>      <xs:complexType name="ci">
>>>>        <xs:sequence>
>>>>          <xs:element name="r" type="xs:float" />
>>>>          <xs:element name="i" type="xs:float" />
>>>>        </xs:sequence>
>>>>      </xs:complexType>
>>>
>>>> in an instance
>>>> like
>>>> <ci>
>>>>    <r>1</r>
>>>>    <i>2</i>
>>>> </ci>
>
>
> If you use XForms markup that looks like that:
>
> <myNamespace:complexNumberInput ref="myinstance/ci">
>    <xf:label="Complex input:">
> </myNamespace:complexNumberInput>
>
> Then you can use XSLT to replace all myNamespace:complexNumberInput with
> the "real" XForms markup, e.g.
>
> <xf:label="Complex input:">
> <xf:input ref="myinstance/ci/r">  +<xf:input ref="myinstance/ci/i">i
>
> If you do not want to use your own tag names, you might be able to do
> preprocessing based on the PSVI of your instance and get the schema
> information from there (you can use Xerces or Saxon-SA to get that
> information).
>
> The benefit of this preprocessing solution is that it works with every
> XForms processor in case you want to migrate to another solution or
> target other devices.
>
> HTH
>
> Philipp
>
>
> [1] There were some attempts, see
> http://xformsinstitute.com/essentials/browse/ch11.php for details, but
> e.g. the mustUnderstand attribute has been removed from XForms 1.1.
>>
>> -john
>>
>>
>> On Jan 11, 2:35 pm, Aaron Reed<[hidden email]>  wrote:
>>> Hi John,
>>>
>>> Did you read and try this?https://developer.mozilla.org/en/XForms/Custom_Controls
>>>
>>> All of the Mozilla XForms controls are done this way and I don't see why
>>> it wouldn't work for what you want to do.
>>>
>>> --Aaron
>>>
>>>
>>>
>>> john wright wrote:
>>>> Hi,
>>>> I've been looking around at custom xforms and xbl extensions but I
>>>> don't think I've seen an explanation of how (as a mozilla extension or
>>>> straight xforms) to do this.
>>>
>>>> Say I have a simple complex type like
>>>>      <xs:complexType name="ci">
>>>>        <xs:sequence>
>>>>          <xs:element name="r" type="xs:float" />
>>>>          <xs:element name="i" type="xs:float" />
>>>>        </xs:sequence>
>>>>      </xs:complexType>
>>>
>>>> in an instance
>>>> like
>>>> <ci>
>>>>    <r>1</r>
>>>>    <i>2</i>
>>>> </ci>
>>>> and then I want to reference it in an input control:
>>>> <input ref="myinstance/ci"><label="Complex input:"></input>
>>>> and I want it to appear as
>>>> Complex input: [1]+[2]i
>>>
>>>> without any additional information in the xforms markup. Basically, I
>>>> want the input to be aware of schema defined types and have an xbl
>>>> binding to them to describe how the input should appear.
>>>
>>>> I have seen ways to do form display bindings with css classes and
>>>> media types but I don't want to add anything to the input block just
>>>> have it be aware user defined types and display as defined elsewhere.
>>>
>>>> Any ideas or suggestions? This would really be helpful in building up
>>>> a set of type aware widgets that would make building forms a lot more
>>>> modular. And if I decided to change the type or extend a type I
>>>> wouldn't have to change the instance or form data to change the
>>>> appearance and structure of the form.
>>>
>>>> thanks.
>>>> -john
>>
>

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: input forms aware of schema defined types

john wright-24
Thank you for the useful discussion. I suspected this was not possible
within standard. Phillip's XSLT processing is an interesting
suggestion. I'll have to consider how important this is to have
complextypes (in the schema sense) and be able to have inputs for them
in a generic way. I would imagine this is a common issue in processing
lists or catalogues.
-john

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms