Quantcast

How to change date format in xform.

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

How to change date format in xform.

bikkie
Hi All,

I want to change the date format in my application. I used bind as <xf:bind nodeset="/PERSON/DOB/" type="xs:date" /> to the input type. By default its opening a calander in YYYY/MM/DD format but I want to display it on DD/MM/YYYY format.

This is my xhtml page.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<head>
<xf:model id="person_model">
<xf:instance xmlns="" id="person_instance" src="instances/person.xml"/>
<xf:bind nodeset="/PERSON/DOB" type="xs:date" />
</xf:model>
</head>
<body>
<xf:input ref="/PERSON/DOB" >
<xf:label>Date of Birth </xf:label>
</xf:input>
</body>
</html>

and here is the person.xml file kept in instances directory of my project folder:
<PERSON>
<DOB>1900-01-01</DOB>
</PERSON> 
 
please help me to sort it out this problem.

thanks in advance.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to change date format in xform.

Aaron Reed
Hi,

Boy, its been a long time, so maybe someone else has a better idea.  But
I don't think you can change the format that the calendar widget uses
without overriding the calendar behavior using XBL.  There are a few
examples of how to customize the controls using XBL on this newsgroup.
Its not difficult.

If you care less about the presentation than the format of the data in
your instance document, you could just detect when the bound data is
changed and make sure that it is the format that you want.  If it isn't,
you could change it at that point.

Just an FYI, we have a bug open to provide that type of behavior:
https://bugzilla.mozilla.org/show_bug.cgi?id=330483 but unless someone
volunteers I doubt the work will get done.

Sorry that I don't have any better news,
--Aaron

bikkie wrote:

>
> Hi All,
>
> I want to change the date format in my application. I used bind as<xf:bind
> nodeset="/PERSON/DOB/" type="xs:date" />  to the input type. By default its
> opening a calander in YYYY/MM/DD format but I want to display it on
> DD/MM/YYYY format.
>
> This is my xhtml page.
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:ev="http://www.w3.org/2001/xml-events"
> xmlns:xf="http://www.w3.org/2002/xforms"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <head>
> <xf:model id="person_model">
> <xf:instance xmlns="" id="person_instance" src="instances/person.xml"/>
> <xf:bind nodeset="/PERSON/DOB" type="xs:date" />
> </xf:model>
> </head>
> <body>
> <xf:input ref="/PERSON/DOB">
> <xf:label>Date of Birth</xf:label>
> </xf:input>
> </body>
> </html>
>
> and here is the person.xml file kept in instances directory of my project
> folder:
> <PERSON>
> <DOB>1900-01-01</DOB>
> </PERSON>
>
> please help me to sort it out this problem.
>
> thanks in advance.

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

Re: How to change date format in xform.

Philipp Wagner-4
Hi,

just to add some notes to Aaron's message:

Am 18.04.2011 21:13, Aaron Reed wrote:
> Boy, its been a long time, so maybe someone else has a better idea.  But
> I don't think you can change the format that the calendar widget uses
> without overriding the calendar behavior using XBL.  There are a few
> examples of how to customize the controls using XBL on this newsgroup.
> Its not difficult.

True, but be aware that customizing controls with XBL does NOT work
since Firefox 4 for security reasons. If you only have an intranet
application you can override these security checks (look for the Remote
XUL Manager addon).

> If you care less about the presentation than the format of the data in
> your instance document, you could just detect when the bound data is
> changed and make sure that it is the format that you want.  If it isn't,
> you could change it at that point.
>
> Just an FYI, we have a bug open to provide that type of behavior:
> https://bugzilla.mozilla.org/show_bug.cgi?id=330483 but unless someone
> volunteers I doubt the work will get done.

If you want to work on it, contact me and I'll help you to get started;
but make sure you have some time on your hands, the codebase is not
exactly small and takes some time to get used to initially.

Philipp


> bikkie wrote:
>>
>> Hi All,
>>
>> I want to change the date format in my application. I used bind
>> as<xf:bind
>> nodeset="/PERSON/DOB/" type="xs:date" />  to the input type. By
>> default its
>> opening a calander in YYYY/MM/DD format but I want to display it on
>> DD/MM/YYYY format.
>>
>> This is my xhtml page.
>> <html xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:ev="http://www.w3.org/2001/xml-events"
>> xmlns:xf="http://www.w3.org/2002/xforms"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> <head>
>> <xf:model id="person_model">
>> <xf:instance xmlns="" id="person_instance" src="instances/person.xml"/>
>> <xf:bind nodeset="/PERSON/DOB" type="xs:date" />
>> </xf:model>
>> </head>
>> <body>
>> <xf:input ref="/PERSON/DOB">
>> <xf:label>Date of Birth</xf:label>
>> </xf:input>
>> </body>
>> </html>
>>
>> and here is the person.xml file kept in instances directory of my project
>> folder:
>> <PERSON>
>> <DOB>1900-01-01</DOB>
>> </PERSON>
>>
>> please help me to sort it out this problem.
>>
>> thanks in advance.
>

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