Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
4 replies Latest Post - ‏2011-11-28T05:12:42Z by RG9U_kedar_nath
bikkie
bikkie
2 Posts
ACCEPTED ANSWER

Pinned topic How to change date format in xform.

‏2011-04-12T06:49:51Z |
Hi All,

I want to change the date format in my application. I am using Xforms to create xhtml.
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 as shown in attached dateFormat.bmp file but i want to display it on DD/MM/YYYY format.

please help me to sort it out this problem.

thanks in advance.
Updated on 2011-11-28T05:12:42Z at 2011-11-28T05:12:42Z by RG9U_kedar_nath
  • SystemAdmin
    SystemAdmin
    265 Posts
    ACCEPTED ANSWER

    Re: How to change date format in xform.

    ‏2011-04-12T22:03:23Z  in response to bikkie
    Changing the date format is implementation dependent. (For instance, in Orbeon Forms, you use these configuration properties for that purpose.) I recommend you re-post this question in a forum or mailing list specifically dedicated to the particular implementation of XForms you are using.

    Alex
    --
    Orbeon Forms - Web 2.0 Forms, open source, for the Enterprise
    http://www.orbeon.com/
    • bikkie
      bikkie
      2 Posts
      ACCEPTED ANSWER

      Re: How to change date format in xform.

      ‏2011-04-13T06:14:44Z  in response to SystemAdmin
      Hi Alex.

      I am using general xforms its not Orbeon forms. To run this Xform I am using portable firefox with Xform plugin is installed.

      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>
      • SystemAdmin
        SystemAdmin
        265 Posts
        ACCEPTED ANSWER

        Re: How to change date format in xform.

        ‏2011-04-13T06:52:35Z  in response to bikkie
        Hi,

        My point was that since this is not a standard feature of XForms, you should ask about in the mailing list for the implementation you are using, rather than in this forum. Maybe they provide an implementation-specific way to setup what format is used by <xforms:input> when showing dates. For the Mozilla XForms extension mailing list, see:

        http://old.nabble.com/Mozilla---XForms-f20741.html

        (If using Nabble to post, make sure to subscribe to the list before posting.) And you'll let us know how you did it, if you find an answer there.

        Alex
        --
        Orbeon Forms - Web 2.0 Forms, open source, for the Enterprise
        http://www.orbeon.com/
  • RG9U_kedar_nath
    RG9U_kedar_nath
    3 Posts
    ACCEPTED ANSWER

    Re: How to change date format in xform.

    ‏2011-11-28T05:12:42Z  in response to bikkie
    <xs:element name="Date" type="xs:date" />

    <xs:simpleType name="Date">
    <xs:restriction base="xs:string" >
    <xs:pattern value="^(((01-9|12\d|301)\/(013578|102)\/((19|2-9\d)\d{2}))|((01-9|12\d|30)\/(013456789|1012)\/((19|2-9\d)\d{2}))|((01-9|1\d|20-8)\/02\/((19|2-9\d)\d{2}))|(29\/02\/((16-9|2-9\d)(048|2468048|1357926)|((16|2468048|357926)00))))$"></xs:pattern>
    </xs:restriction>
    </xs:simpleType>