Hi everybody,
I'm writing, because I have a problem with a date formatting in my Orbeon 3.7.1. I must have the following format in a date control: YYYY-MM-DD. Unfortunately, there are only 3 types of formatting available now ([M]/[D]/[Y] or [D]/[M]/[Y] or [D].[M].[Y]). It wasn't an issue in Orbeon 3.6, because a date control was rendered as an OUTPUT with a calendar (not as an INPUT with a calendar) and more formats were available. My question is: can I change a date input format to YYYY-MM-DD, or can I change a rendering policy, so a date control is rendered as an output not an input (it's fine for me)? Thanks in advance, Emil |
Emil,
When an input control is bound to a type xs:date or xforms:date, this is currently not possible: we format the date as you mention below. You could still do this by NOT using the xs:date or xforms:date type, and instead using a plain string, and validate with xforms:bind/@constraint. Better yet would be to support YYYY-MM-DD input. To do this, some changes to both the JavaScript code and the Java code is necessary. It wouldn't be too hard to do though. If you feel like trying, please let us know and we can guide you! -Erik On Fri, Oct 30, 2009 at 4:32 AM, Emil <[hidden email]> wrote: > > Hi everybody, > > I'm writing, because I have a problem with a date formatting in my Orbeon > 3.7.1. I must have the following format in a date control: YYYY-MM-DD. > Unfortunately, there are only 3 types of formatting available now > ([M]/[D]/[Y] or [D]/[M]/[Y] or [D].[M].[Y]). It wasn't an issue in Orbeon > 3.6, because a date control was rendered as an OUTPUT with a calendar (not > as an INPUT with a calendar) and more formats were available. My question > is: can I change a date input format to YYYY-MM-DD, or can I change a > rendering policy, so a date control is rendered as an output not an input > (it's fine for me)? > > Thanks in advance, > > Emil > -- > View this message in context: http://n4.nabble.com/Date-formatting-in-Orbeon-3-7-1-tp278175p278175.html > Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com. > > > -- > 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 > OW2 mailing lists service home page: http://www.ow2.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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Erik,
Thank you for your reply. I would be grateful if you could give me some hints how to change this control into an input and add a calendar functionality. Regards
|
Sorry, for my previous reply. It looks like I misunderstood you. Solution I prefer is to use xs:date type and to add ability to input YYYY-MM-DD format. So, I would be grateful if you could help me how to achieve this.
Best regards
|
Administrator
|
Emil,
On Tue, Nov 3, 2009 at 3:22 AM, Emil <[hidden email]> wrote: > Sorry, for my previous reply. It looks like I misunderstood you. Solution I > prefer is to use xs:date type and to add ability to input YYYY-MM-DD format. > So, I would be grateful if you could help me how to achieve this. I think what follows should do the trick: - Instead of: <xforms:bind type="xs:date"> - Write: <xforms:bind constraint=". castable as xs:date"> This way you will check that the user entered a date, but you won't tell the XForms that the node is of type date, so it won't change its "appearance" to have a date picker. Alex -- Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Alex,
Thank you for your tip. Actually, I do want to have a date picker, so it's not a solution which satisfies me in 100% :) Erik, could you provide me with some more info about the solution you were writing about. I would be grateful. Best regards Emil
|
Administrator
|
Emil,
On Tue, Nov 10, 2009 at 12:47 AM, Emil <[hidden email]> wrote: > Thank you for your tip. Actually, I do want to have a date picker, so it's > not a solution which satisfies me in 100% :) > Erik, could you provide me with some more info about the solution you were > writing about. I would be grateful. * The property driving this is oxf.xforms.format.input.date, defined in properties-xforms.xml. There you will want to put your format. * The client-side and server-side code always communicate using the ISO format. So you need to change the parsing / displaying code in xforms.js (used when the user changes the value, or a new value is received from the server) and in Java (used when generating the HTML). * On the JavaScript side, this is in xforms.js, in ORBEON.util.DateTime. * In the Java side, you might not have to change anything. I think the code calls the format-date() with the picture you defined in properties-xforms.js, so it might just work out of the box. Otherwise, you can start by the class XFormsInputHandler which is where the HTML generation starts. To help with the changes to the JavaScript code, see: http://wiki.orbeon.com/forms/doc/contributor-guide/javascript-development You'll let us know how it goes! Alex -- Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
People
I am attempting to bind an .xsd schema to form controls. It appears I have done this correctly as I have not put any type= information into the form bindings, but the input boxes will go red if the correct format is not used. I achieved this by putting the instance, .xsd, and bind commands in the same namespace. Also, I know the instance conforms to the schema as it was genereted from it using oXygen. My question ----------- Some of the fields are of type datetime. I have found that if I put type="xs:dateTime" in the form binding then it all works fine. But if I leave it out the form will display a single input box with no datepicker. I would have thought the form would use the type from the schema. Also, what is odd is that if I paste in something like: 2009-11-03T03:00:00 It will then change into the two separate boxes and display the datepicker. Could anyone shed some light on this? Cheers Steven -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
..Bump.. -----Original Message----- (updated)
People I am attempting to bind an .xsd schema (separate file) to form controls. It appears I have done this correctly as I have not put any type= information into the form bindings, but the input boxes will go red if the correct format is not used. My question
2009-11-03T03:00:00
Could anyone shed some light on this? Is this a bug? My goal is to have all type information in the .xsd schema so that if I change it the form will automatically reflect this. I can post some example files if need be. Cheers Steven -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Steven,
I've had the same problem: This is happening because the schema validator tells the XForms code about the type of the node only if the node is valid. So when the form is loaded, the XForms code doesn't know <date> contains a date; it just knows that this field is invalid. Then when you enter a date, the validator runs again and then tells the XForms code that this is an xs:date, at which point the XForms engine can switch the appearance of the field to a date picker. Obviously, this is not what you want. But it is unclear if we can even get the validator to tell the XForms code about the type of the node when it is invalid. So in essence, you can't use a schema to influence how the <xforms:input> is rendered (text field, date picker, checkbox); you need to use an <xforms:bind> for that. Of course, you can still use the schema to validate the data. BTW, thank you for the use case you attached. Alex -- Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet Steven Kerr schrieb: > ..Bump.. > > -----Original Message----- (updated) > From: Steven Kerr > Sent: Thursday, 26 November 2009 13:37 > To: [hidden email] > Subject: [ops-users] .xsd schema and forms > > People > > I am attempting to bind an .xsd schema (separate file) to form > controls. It appears I have done this correctly as I have not put any > type= information into the form bindings, but the input boxes will go > red if the correct format is not used. > > _My question_ > Some of the fields are of type* datetime*. I have found that if I put > type="xs:dateTime" in the form binding then it all works fine. But if I > leave it out, the form will display a single input box with no > datepicker. I would like the form get type information from the schema > and work the same as if I had but it in the form bindings. Also, what > is odd is that if I paste in something like: > > 2009-11-03T03:00:00 > It will then change into the two separate boxes and display the > datepicker correctly. > > Could anyone shed some light on this? Is this a bug? My goal is to > have all type information in the .xsd schema so that if I change it the > form will automatically reflect this. > > I can post some example files if need be. > > Cheers > > Steven > -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi, we also had this problem and were only able to resolve it by including a bunch of <xforms:bind nodeset="mydatefieldname" type="xforms:date"/> type declarations in the model section. Far from ideal as you have pointed out, as we'd also like all type information to be picked up from the schema, but it does work.
Bryn -----Original Message----- From: Baschir Jaghoori [mailto:[hidden email]] Sent: 30 November 2009 08:59 To: [hidden email] Subject: [ops-users] Re: RE: .xsd schema and forms Hi Steven, I've had the same problem: This is happening because the schema validator tells the XForms code about the type of the node only if the node is valid. So when the form is loaded, the XForms code doesn't know <date> contains a date; it just knows that this field is invalid. Then when you enter a date, the validator runs again and then tells the XForms code that this is an xs:date, at which point the XForms engine can switch the appearance of the field to a date picker. Obviously, this is not what you want. But it is unclear if we can even get the validator to tell the XForms code about the type of the node when it is invalid. So in essence, you can't use a schema to influence how the <xforms:input> is rendered (text field, date picker, checkbox); you need to use an <xforms:bind> for that. Of course, you can still use the schema to validate the data. BTW, thank you for the use case you attached. Alex -- Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet Steven Kerr schrieb: > ..Bump.. > > -----Original Message----- (updated) > From: Steven Kerr > Sent: Thursday, 26 November 2009 13:37 > To: [hidden email] > Subject: [ops-users] .xsd schema and forms > > People > > I am attempting to bind an .xsd schema (separate file) to form > controls. It appears I have done this correctly as I have not put any > type= information into the form bindings, but the input boxes will go > red if the correct format is not used. > > _My question_ > Some of the fields are of type* datetime*. I have found that if I put > type="xs:dateTime" in the form binding then it all works fine. But if I > leave it out, the form will display a single input box with no > datepicker. I would like the form get type information from the schema > and work the same as if I had but it in the form bindings. Also, what > is odd is that if I paste in something like: > > 2009-11-03T03:00:00 > It will then change into the two separate boxes and display the > datepicker correctly. > > Could anyone shed some light on this? Is this a bug? My goal is to > have all type information in the .xsd schema so that if I change it the > form will automatically reflect this. > > I can post some example files if need be. > > Cheers > > Steven > -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Thanks Bryn & Alex. That's really good to know and will save me from
fruitless testing :) -----Original Message----- From: Bryn Davies [mailto:[hidden email]] Sent: Monday, 30 November 2009 19:08 To: [hidden email] Subject: [ops-users] RE: Re: RE: .xsd schema and forms Hi, we also had this problem and were only able to resolve it by including a bunch of <xforms:bind nodeset="mydatefieldname" type="xforms:date"/> type declarations in the model section. Far from ideal as you have pointed out, as we'd also like all type information to be picked up from the schema, but it does work. Bryn -----Original Message----- From: Baschir Jaghoori [mailto:[hidden email]] Sent: 30 November 2009 08:59 To: [hidden email] Subject: [ops-users] Re: RE: .xsd schema and forms Hi Steven, I've had the same problem: This is happening because the schema validator tells the XForms code about the type of the node only if the node is valid. So when the form is loaded, the XForms code doesn't know <date> contains a date; it just knows that this field is invalid. Then when you enter a date, the validator runs again and then tells the XForms code that this is an xs:date, at which point the XForms engine can switch the appearance of the field to a date picker. Obviously, this is not what you want. But it is unclear if we can even get the validator to tell the XForms code about the type of the node when it is invalid. So in essence, you can't use a schema to influence how the <xforms:input> is rendered (text field, date picker, checkbox); you need to use an <xforms:bind> for that. Of course, you can still use the schema to validate the data. BTW, thank you for the use case you attached. Alex -- Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet Steven Kerr schrieb: > ..Bump.. > > -----Original Message----- (updated) > From: Steven Kerr > Sent: Thursday, 26 November 2009 13:37 > To: [hidden email] > Subject: [ops-users] .xsd schema and forms > > People > > I am attempting to bind an .xsd schema (separate file) to form > controls. It appears I have done this correctly as I have not put any > type= information into the form bindings, but the input boxes will go > red if the correct format is not used. > > _My question_ > Some of the fields are of type* datetime*. I have found that if I put > type="xs:dateTime" in the form binding then it all works fine. But if > I leave it out, the form will display a single input box with no > datepicker. I would like the form get type information from the schema > and work the same as if I had but it in the form bindings. Also, what > is odd is that if I paste in something like: > > 2009-11-03T03:00:00 > It will then change into the two separate boxes and display the > datepicker correctly. > > Could anyone shed some light on this? Is this a bug? My goal is to > have all type information in the .xsd schema so that if I change it > the form will automatically reflect this. > > I can post some example files if need be. > > Cheers > > Steven > -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
All,
Just to confirm that yes, unfortunately, using xforms:bind to force the date type is the way to work around this issue. -Erik On Mon, Nov 30, 2009 at 3:44 PM, Steven Kerr <[hidden email]> wrote: > Thanks Bryn & Alex. That's really good to know and will save me from > fruitless testing :) > > -----Original Message----- > From: Bryn Davies [mailto:[hidden email]] > Sent: Monday, 30 November 2009 19:08 > To: [hidden email] > Subject: [ops-users] RE: Re: RE: .xsd schema and forms > > Hi, we also had this problem and were only able to resolve it by > including a bunch of <xforms:bind nodeset="mydatefieldname" > type="xforms:date"/> type declarations in the model section. Far from > ideal as you have pointed out, as we'd also like all type information to > be picked up from the schema, but it does work. > > Bryn > > -----Original Message----- > From: Baschir Jaghoori [mailto:[hidden email]] > Sent: 30 November 2009 08:59 > To: [hidden email] > Subject: [ops-users] Re: RE: .xsd schema and forms > > Hi Steven, > > I've had the same problem: > > This is happening because the schema validator tells the XForms code > about the type of the node only if the node is valid. So when the form > is loaded, the XForms code doesn't know <date> contains a date; it just > knows that this field is invalid. Then when you enter a date, the > validator runs again and then tells the XForms code that this is an > xs:date, at which point the XForms engine can switch the appearance of > the field to a date picker. > > Obviously, this is not what you want. But it is unclear if we can even > get the validator to tell the XForms code about the type of the node > when it is invalid. So in essence, you can't use a schema to influence > how the <xforms:input> is rendered (text field, date picker, checkbox); > you need to use an <xforms:bind> for that. Of course, you can still use > the schema to validate the data. > > BTW, thank you for the use case you attached. > > Alex > -- Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's > Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet > > > Steven Kerr schrieb: >> ..Bump.. >> >> -----Original Message----- (updated) >> From: Steven Kerr >> Sent: Thursday, 26 November 2009 13:37 >> To: [hidden email] >> Subject: [ops-users] .xsd schema and forms >> >> People >> >> I am attempting to bind an .xsd schema (separate file) to form >> controls. It appears I have done this correctly as I have not put any > >> type= information into the form bindings, but the input boxes will go >> red if the correct format is not used. >> >> _My question_ >> Some of the fields are of type* datetime*. I have found that if I put > >> type="xs:dateTime" in the form binding then it all works fine. But if > >> I leave it out, the form will display a single input box with no >> datepicker. I would like the form get type information from the schema > >> and work the same as if I had but it in the form bindings. Also, what > >> is odd is that if I paste in something like: >> >> 2009-11-03T03:00:00 >> It will then change into the two separate boxes and display the >> datepicker correctly. >> >> Could anyone shed some light on this? Is this a bug? My goal is to >> have all type information in the .xsd schema so that if I change it >> the form will automatically reflect this. >> >> I can post some example files if need be. >> >> Cheers >> >> Steven >> > > > > > -- > 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 > OW2 mailing lists service home page: http://www.ow2.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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |