Displaying the date in the text fields

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

Displaying the date in the text fields

Amar-2
Hi,

I have requirement to display the date in an input field such that the user is provided the option of either typing the date or choosing it using the date picker.

To acheive this I modified the xforms.css file and commented out the display: none; for the input.xforms-type-date class. This ended up showing the textfield, but when choosing a date using the date picker, it displayed it in the textfield as well as the span containing the formatted date. View example ran in sandbox here date.xhtml

The span element contained the xforms-date-display class. Therefore, I added one more class, span.xforms-date-display, to the xforms.css with display:none . View example ran in the sandbox here date_nospan.xhtml

This seemed to have eliminated the span displaying the formatted date. However, upon clicking on the textfield, the date picker pops-up.

Digging further deeper into the OPS code, I noticed that the spans and the input field are generated using the XFormsInputHandler class.

What I really wanted to know is that does OPS provide a way to show both the textfield and the date picker such that clicking the textfield doesn't pop-up the calendar?

Also if there is a way to extend the XFormsInputHandler class to have my own custom class with which I can have it to display the textfield? This is because the main requirement I have is to provide the user with three textfields i.e for the day, month and year along with the date picker.

Any assistance will be highly appreciated. I am using OPS version 3.5.

Reply | Threaded
Open this post in threaded view
|

Re: Displaying the date in the text fields

Erik Bruchez
Administrator
Amar,

 > I have requirement to display the date in an input field such that
 > the user is provided the option of either typing the date or
 > choosing it using the date picker.

It is of course quite a reasonable thing you are trying to do, which I
would summarize globally as "improving the date selector".

 > What I really wanted to know is that does OPS provide a way to show
 > both the textfield and the date picker such that clicking the
 > textfield doesn't pop-up the calendar?

Currently, OPS does not really support that directly, as you have
experienced. And it is in fact not quite that trivial, as users
probably don't want to enter a date in XML schema format
(e.g. 2006-09-20), but rather in one of the localized formats such as
9/20/06 or 20.9.2006, etc.

I think we should progressively incorporate such functionality
directly into OPS, but it's going to be some work possibly involving
server-side (in particular XFormsInputHandler) and certainly
client-side (xforms.js).

 > Digging further deeper into the OPS code, I noticed that the spans
 > and the input field are generated using the XFormsInputHandler
 > class.

 > Also if there is a way to *extend* the XFormsInputHandler class to
 > have my own custom class with which I can have it to display the
 > textfield?  This is because the main requirement I have is to
 > provide the user with three textfields i.e for the day, month and
 > year along with the date picker.

Currently, classes such as XFormsInputHandler are "private" and not
meant to be modified by the user (although of course OPS is open
source so you are always free to hack away ;-).

Another avenue for the future will be to allow form authors to develop
reusable components in XForms. Some Working Group members have already
proposed some quite interesting ideas on the topic. This means that
you will be able to create your special date picker component
(e.g. with 3 separate fields) and to reuse that in multiple places in
your forms. However this is for the future.

In the meanwhile, you could manually create this sort of component by
using a separate XForms instance to store dates as components, and
bind 3 xforms:select1 or 3 xforms:input to those components, e.g.:

<date>
   <day/>
   <month/>
   <year/>
</date>

Then upon xforms-value-change of the controls, you would copy over the
selected value to your main XForms instance, e.g. with something like:

<xforms:setvalue ref="my-date" value="concat(year, '-', month, '-', day)"/>

(This would be in fact a little more complex because you need to
format the numbers as 4, 2 and 2 digits respectively.)

For the date picker, this is a little more complex too: you could use
xforms:switch around the input fields and an actual date field, and
switch to the current date picker when the user clicks on a date
selection icon.

I am aware that this is fairly heavy and not ideal but it could work.

 > Any assistance will be highly appreciated. I am using OPS version
 > 3.5.

Minor nitpick: it's 3.5 M1, not 3.5. I just want to make it clear that
3.5 final has not yet been released.

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: Displaying the date in the text fields

Erik Bruchez
Administrator
FYI I entered an RFE to track this:

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

Also, the work done by Adrian for xs:dateTime and xs:time should be
considered. It's a shame, but we haven't yet integrated any of this:

http://mail-archive.objectweb.org/ops-development/2006-04/msg00008.html

-Erik

Erik Bruchez wrote:

> Amar,
>
>  > I have requirement to display the date in an input field such that
>  > the user is provided the option of either typing the date or
>  > choosing it using the date picker.
>
> It is of course quite a reasonable thing you are trying to do, which I
> would summarize globally as "improving the date selector".
>
>  > What I really wanted to know is that does OPS provide a way to show
>  > both the textfield and the date picker such that clicking the
>  > textfield doesn't pop-up the calendar?
>
> Currently, OPS does not really support that directly, as you have
> experienced. And it is in fact not quite that trivial, as users
> probably don't want to enter a date in XML schema format
> (e.g. 2006-09-20), but rather in one of the localized formats such as
> 9/20/06 or 20.9.2006, etc.
>
> I think we should progressively incorporate such functionality
> directly into OPS, but it's going to be some work possibly involving
> server-side (in particular XFormsInputHandler) and certainly
> client-side (xforms.js).
>
>  > Digging further deeper into the OPS code, I noticed that the spans
>  > and the input field are generated using the XFormsInputHandler
>  > class.
>
>  > Also if there is a way to *extend* the XFormsInputHandler class to
>  > have my own custom class with which I can have it to display the
>  > textfield?  This is because the main requirement I have is to
>  > provide the user with three textfields i.e for the day, month and
>  > year along with the date picker.
>
> Currently, classes such as XFormsInputHandler are "private" and not
> meant to be modified by the user (although of course OPS is open
> source so you are always free to hack away ;-).
>
> Another avenue for the future will be to allow form authors to develop
> reusable components in XForms. Some Working Group members have already
> proposed some quite interesting ideas on the topic. This means that
> you will be able to create your special date picker component
> (e.g. with 3 separate fields) and to reuse that in multiple places in
> your forms. However this is for the future.
>
> In the meanwhile, you could manually create this sort of component by
> using a separate XForms instance to store dates as components, and
> bind 3 xforms:select1 or 3 xforms:input to those components, e.g.:
>
> <date>
>   <day/>
>   <month/>
>   <year/>
> </date>
>
> Then upon xforms-value-change of the controls, you would copy over the
> selected value to your main XForms instance, e.g. with something like:
>
> <xforms:setvalue ref="my-date" value="concat(year, '-', month, '-', day)"/>
>
> (This would be in fact a little more complex because you need to
> format the numbers as 4, 2 and 2 digits respectively.)
>
> For the date picker, this is a little more complex too: you could use
> xforms:switch around the input fields and an actual date field, and
> switch to the current date picker when the user clicks on a date
> selection icon.
>
> I am aware that this is fairly heavy and not ideal but it could work.
>
>  > Any assistance will be highly appreciated. I am using OPS version
>  > 3.5.
>
> Minor nitpick: it's 3.5 M1, not 3.5. I just want to make it clear that
> 3.5 final has not yet been released.
>
> -Erik
>

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: Displaying the date in the text fields

Duane Gran-2
Just to add to the discussion, on two projects I've reverted to using  
a plain text field for entry instead of the date picker because:

1) The date element in the bind supported more than one date format,  
denoted in an attribute
2) There are occasions which warrant listing an imprecise date

The current mode for activating the date widget is through the  
following binding:

<xforms:bind nodeset="mods:recordInfo/mods:recordCreationDate"  
type="xs:date"/>

My pie-in-the-sky notion would be a text field which support for  
various date formats and validates them against appropriate schema-
based types.  I have an application which can accept dates in ISO  
8601, MARC and w3cdtf (which is a smaller scope of 8601).  For 99% of  
the applications I suspect such a text field bound to ISO 8601 would  
do the trick.

Duane

On Sep 20, 2006, at 6:49 AM, Erik Bruchez wrote:

> FYI I entered an RFE to track this:
>
> http://forge.objectweb.org/tracker/index.php?
> func=detail&aid=306172&group_id=168&atid=350207
>
> Also, the work done by Adrian for xs:dateTime and xs:time should be  
> considered. It's a shame, but we haven't yet integrated any of this:
>
> http://mail-archive.objectweb.org/ops-development/2006-04/ 
> msg00008.html
>
> -Erik
>
> Erik Bruchez wrote:
>> Amar,
>>  > I have requirement to display the date in an input field such that
>>  > the user is provided the option of either typing the date or
>>  > choosing it using the date picker.
>> It is of course quite a reasonable thing you are trying to do,  
>> which I
>> would summarize globally as "improving the date selector".
>>  > What I really wanted to know is that does OPS provide a way to  
>> show
>>  > both the textfield and the date picker such that clicking the
>>  > textfield doesn't pop-up the calendar?
>> Currently, OPS does not really support that directly, as you have
>> experienced. And it is in fact not quite that trivial, as users
>> probably don't want to enter a date in XML schema format
>> (e.g. 2006-09-20), but rather in one of the localized formats such as
>> 9/20/06 or 20.9.2006, etc.
>> I think we should progressively incorporate such functionality
>> directly into OPS, but it's going to be some work possibly involving
>> server-side (in particular XFormsInputHandler) and certainly
>> client-side (xforms.js).
>>  > Digging further deeper into the OPS code, I noticed that the spans
>>  > and the input field are generated using the XFormsInputHandler
>>  > class.
>>  > Also if there is a way to *extend* the XFormsInputHandler class to
>>  > have my own custom class with which I can have it to display the
>>  > textfield?  This is because the main requirement I have is to
>>  > provide the user with three textfields i.e for the day, month and
>>  > year along with the date picker.
>> Currently, classes such as XFormsInputHandler are "private" and not
>> meant to be modified by the user (although of course OPS is open
>> source so you are always free to hack away ;-).
>> Another avenue for the future will be to allow form authors to  
>> develop
>> reusable components in XForms. Some Working Group members have  
>> already
>> proposed some quite interesting ideas on the topic. This means that
>> you will be able to create your special date picker component
>> (e.g. with 3 separate fields) and to reuse that in multiple places in
>> your forms. However this is for the future.
>> In the meanwhile, you could manually create this sort of component by
>> using a separate XForms instance to store dates as components, and
>> bind 3 xforms:select1 or 3 xforms:input to those components, e.g.:
>> <date>
>>   <day/>
>>   <month/>
>>   <year/>
>> </date>
>> Then upon xforms-value-change of the controls, you would copy over  
>> the
>> selected value to your main XForms instance, e.g. with something  
>> like:
>> <xforms:setvalue ref="my-date" value="concat(year, '-', month,  
>> '-', day)"/>
>> (This would be in fact a little more complex because you need to
>> format the numbers as 4, 2 and 2 digits respectively.)
>> For the date picker, this is a little more complex too: you could use
>> xforms:switch around the input fields and an actual date field, and
>> switch to the current date picker when the user clicks on a date
>> selection icon.
>> I am aware that this is fairly heavy and not ideal but it could work.
>>  > Any assistance will be highly appreciated. I am using OPS version
>>  > 3.5.
>> Minor nitpick: it's 3.5 M1, not 3.5. I just want to make it clear  
>> that
>> 3.5 final has not yet been released.
>> -Erik
>
>
> --
> Orbeon - XForms Everywhere:
> http://www.orbeon.com/blog/
>
>
> --
> You receive this message as a subscriber of the ops-
> [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



--
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: Displaying the date in the text fields

Erik Bruchez
Administrator
Duane,

You are quite right. There are two fairly different notions here:

1. The value entered by the user, which should be human-readable and
depend on locale and personal preferences.

2. The value stored in the XForms instance, which in 99% of the cases
should follow the standard ISO format for dates (e.g. 2006-09-20 with
possibly some timezone information). And the remaining 1% of use cases
should change to follow the XML Schema data types ;-)

I would put a fairly high priority on supporting #1, but a low priority
on supporting more date formats for #2.

-Erik

Duane Gran wrote:

> Just to add to the discussion, on two projects I've reverted to using a
> plain text field for entry instead of the date picker because:
>
> 1) The date element in the bind supported more than one date format,
> denoted in an attribute
> 2) There are occasions which warrant listing an imprecise date
>
> The current mode for activating the date widget is through the following
> binding:
>
> <xforms:bind nodeset="mods:recordInfo/mods:recordCreationDate"
> type="xs:date"/>
>
> My pie-in-the-sky notion would be a text field which support for various
> date formats and validates them against appropriate schema-based types.  
> I have an application which can accept dates in ISO 8601, MARC and
> w3cdtf (which is a smaller scope of 8601).  For 99% of the applications
> I suspect such a text field bound to ISO 8601 would do the trick.
>
> Duane
>
> On Sep 20, 2006, at 6:49 AM, Erik Bruchez wrote:
>
>> FYI I entered an RFE to track this:
>>
>> http://forge.objectweb.org/tracker/index.php?func=detail&aid=306172&group_id=168&atid=350207 
>>
>>
>> Also, the work done by Adrian for xs:dateTime and xs:time should be
>> considered. It's a shame, but we haven't yet integrated any of this:
>>
>> http://mail-archive.objectweb.org/ops-development/2006-04/msg00008.html
>>
>> -Erik
>>
>> Erik Bruchez wrote:
>>> Amar,
>>>  > I have requirement to display the date in an input field such that
>>>  > the user is provided the option of either typing the date or
>>>  > choosing it using the date picker.
>>> It is of course quite a reasonable thing you are trying to do, which I
>>> would summarize globally as "improving the date selector".
>>>  > What I really wanted to know is that does OPS provide a way to show
>>>  > both the textfield and the date picker such that clicking the
>>>  > textfield doesn't pop-up the calendar?
>>> Currently, OPS does not really support that directly, as you have
>>> experienced. And it is in fact not quite that trivial, as users
>>> probably don't want to enter a date in XML schema format
>>> (e.g. 2006-09-20), but rather in one of the localized formats such as
>>> 9/20/06 or 20.9.2006, etc.
>>> I think we should progressively incorporate such functionality
>>> directly into OPS, but it's going to be some work possibly involving
>>> server-side (in particular XFormsInputHandler) and certainly
>>> client-side (xforms.js).
>>>  > Digging further deeper into the OPS code, I noticed that the spans
>>>  > and the input field are generated using the XFormsInputHandler
>>>  > class.
>>>  > Also if there is a way to *extend* the XFormsInputHandler class to
>>>  > have my own custom class with which I can have it to display the
>>>  > textfield?  This is because the main requirement I have is to
>>>  > provide the user with three textfields i.e for the day, month and
>>>  > year along with the date picker.
>>> Currently, classes such as XFormsInputHandler are "private" and not
>>> meant to be modified by the user (although of course OPS is open
>>> source so you are always free to hack away ;-).
>>> Another avenue for the future will be to allow form authors to develop
>>> reusable components in XForms. Some Working Group members have already
>>> proposed some quite interesting ideas on the topic. This means that
>>> you will be able to create your special date picker component
>>> (e.g. with 3 separate fields) and to reuse that in multiple places in
>>> your forms. However this is for the future.
>>> In the meanwhile, you could manually create this sort of component by
>>> using a separate XForms instance to store dates as components, and
>>> bind 3 xforms:select1 or 3 xforms:input to those components, e.g.:
>>> <date>
>>>   <day/>
>>>   <month/>
>>>   <year/>
>>> </date>
>>> Then upon xforms-value-change of the controls, you would copy over the
>>> selected value to your main XForms instance, e.g. with something like:
>>> <xforms:setvalue ref="my-date" value="concat(year, '-', month, '-',
>>> day)"/>
>>> (This would be in fact a little more complex because you need to
>>> format the numbers as 4, 2 and 2 digits respectively.)
>>> For the date picker, this is a little more complex too: you could use
>>> xforms:switch around the input fields and an actual date field, and
>>> switch to the current date picker when the user clicks on a date
>>> selection icon.
>>> I am aware that this is fairly heavy and not ideal but it could work.
>>>  > Any assistance will be highly appreciated. I am using OPS version
>>>  > 3.5.
>>> Minor nitpick: it's 3.5 M1, not 3.5. I just want to make it clear that
>>> 3.5 final has not yet been released.
>>> -Erik
>>
>>
>> --Orbeon - XForms Everywhere:
>> http://www.orbeon.com/blog/
>>
>>
>> --
>> 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
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: Displaying the date in the text fields

ilango_g
In reply to this post by Duane Gran-2
I have tried very hard to get a text field bound to a date field, but I have not had any success. Have you implemented this in your application?
Duane Gran-2 wrote
Just to add to the discussion, on two projects I've reverted to using  
a plain text field for entry instead of the date picker because:

1) The date element in the bind supported more than one date format,  
denoted in an attribute
2) There are occasions which warrant listing an imprecise date

The current mode for activating the date widget is through the  
following binding:

<xforms:bind nodeset="mods:recordInfo/mods:recordCreationDate"  
type="xs:date"/>

My pie-in-the-sky notion would be a text field which support for  
various date formats and validates them against appropriate schema-
based types.  I have an application which can accept dates in ISO  
8601, MARC and w3cdtf (which is a smaller scope of 8601).  For 99% of  
the applications I suspect such a text field bound to ISO 8601 would  
do the trick.

Duane

On Sep 20, 2006, at 6:49 AM, Erik Bruchez wrote:

> FYI I entered an RFE to track this:
>
> http://forge.objectweb.org/tracker/index.php?
> func=detail&aid=306172&group_id=168&atid=350207
>
> Also, the work done by Adrian for xs:dateTime and xs:time should be  
> considered. It's a shame, but we haven't yet integrated any of this:
>
> http://mail-archive.objectweb.org/ops-development/2006-04/ 
> msg00008.html
>
> -Erik
>
> Erik Bruchez wrote:
>> Amar,
>>  > I have requirement to display the date in an input field such that
>>  > the user is provided the option of either typing the date or
>>  > choosing it using the date picker.
>> It is of course quite a reasonable thing you are trying to do,  
>> which I
>> would summarize globally as "improving the date selector".
>>  > What I really wanted to know is that does OPS provide a way to  
>> show
>>  > both the textfield and the date picker such that clicking the
>>  > textfield doesn't pop-up the calendar?
>> Currently, OPS does not really support that directly, as you have
>> experienced. And it is in fact not quite that trivial, as users
>> probably don't want to enter a date in XML schema format
>> (e.g. 2006-09-20), but rather in one of the localized formats such as
>> 9/20/06 or 20.9.2006, etc.
>> I think we should progressively incorporate such functionality
>> directly into OPS, but it's going to be some work possibly involving
>> server-side (in particular XFormsInputHandler) and certainly
>> client-side (xforms.js).
>>  > Digging further deeper into the OPS code, I noticed that the spans
>>  > and the input field are generated using the XFormsInputHandler
>>  > class.
>>  > Also if there is a way to *extend* the XFormsInputHandler class to
>>  > have my own custom class with which I can have it to display the
>>  > textfield?  This is because the main requirement I have is to
>>  > provide the user with three textfields i.e for the day, month and
>>  > year along with the date picker.
>> Currently, classes such as XFormsInputHandler are "private" and not
>> meant to be modified by the user (although of course OPS is open
>> source so you are always free to hack away ;-).
>> Another avenue for the future will be to allow form authors to  
>> develop
>> reusable components in XForms. Some Working Group members have  
>> already
>> proposed some quite interesting ideas on the topic. This means that
>> you will be able to create your special date picker component
>> (e.g. with 3 separate fields) and to reuse that in multiple places in
>> your forms. However this is for the future.
>> In the meanwhile, you could manually create this sort of component by
>> using a separate XForms instance to store dates as components, and
>> bind 3 xforms:select1 or 3 xforms:input to those components, e.g.:
>> <date>
>>   <day/>
>>   <month/>
>>   <year/>
>> </date>
>> Then upon xforms-value-change of the controls, you would copy over  
>> the
>> selected value to your main XForms instance, e.g. with something  
>> like:
>> <xforms:setvalue ref="my-date" value="concat(year, '-', month,  
>> '-', day)"/>
>> (This would be in fact a little more complex because you need to
>> format the numbers as 4, 2 and 2 digits respectively.)
>> For the date picker, this is a little more complex too: you could use
>> xforms:switch around the input fields and an actual date field, and
>> switch to the current date picker when the user clicks on a date
>> selection icon.
>> I am aware that this is fairly heavy and not ideal but it could work.
>>  > Any assistance will be highly appreciated. I am using OPS version
>>  > 3.5.
>> Minor nitpick: it's 3.5 M1, not 3.5. I just want to make it clear  
>> that
>> 3.5 final has not yet been released.
>> -Erik
>
>
> --
> Orbeon - XForms Everywhere:
> http://www.orbeon.com/blog/
>
>
> --
> You receive this message as a subscriber of the ops-
> users@objectweb.org mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
> For general help: mailto:sympa@objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/ 
> wws




--
You receive this message as a subscriber of the ops-users@objectweb.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws