Can anyone give me a pointer on how to make a date field optional, but
still have a date control? Currently Orbeon displays an error on the
page indicating the field is not formated properly when it is left
blank. I believe this is because XML requires date fields to have a
value.
Below are the binding and field declaration sections of my page. The file config-instance.xml declares the field to be optional. Binding: <xforms:bind id="SI_PIExpirationDateBind" type="xs:date" nodeset="instance('default-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIExpirationDate" required="(instance('config-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIExpirationDate = 1)" /> Field: <xforms:input bind="SI_PIExpirationDateBind"> <xforms:label class="theftDetails-label">Expiration Date </xforms:label> <xforms:help><b>Expiration Date: </b>The date the Identification expires</xforms:help> <xforms:alert>015: The Expiration date must be a valid date</xforms:alert> <xforms:action ev:event="xforms-invalid" if="normalize-space(event('alert')) != ''"> <xforms:insert context="instance('errors-instance')" nodeset="error" origin="instance('error-template')"/> <xforms:setvalue ref="instance('errors-instance')/error[index('errors-repeat')]/@id" value="substring(string(event('alert')),1,3)"/> <xforms:setvalue ref="instance('errors-instance')/error[index('errors-repeat')]/@label" value="event('label')"/> <xforms:setvalue ref="instance('errors-instance')/error[index('errors-repeat')]/@alert" value="substring(string(event('alert')),7)"/> </xforms:action> <xforms:action ev:event="xforms-valid" if="instance('errors-instance')/error[@id = substring(string(event('alert')),1,3)]"> <xforms:delete nodeset="instance('errors-instance')/error[@id = substring(string(event('alert')),1,3)]"/> </xforms:action> </xforms:input>I had a similar problem with numeric fields, but was able to resolve it for them by changing the binding like this. Unfortunately I can't do this for dates because I will loose the date control. <xforms:bind id="SI_LocationPostalCodeIDBind" type="xs:string" nodeset="instance('default-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIIssuingOrganization/OrganizationContactInfo/ContactMailingAddress/LocationPostalCodeID" required="(instance('config-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIIssuingOrganization/OrganizationContactInfo/ContactMailingAddress/LocationPostalCodeID = 1)" constraint="(. = null) or (string-length(.) = 0) or (. castable as xs:integer and string-length(.) = 5)" /> Thanks, Dustin -- 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 Dustin,
> Can anyone give me a pointer on how to make a date field optional, but > still have a date control? Currently Orbeon displays an error on the > page indicating the field is not formated properly when it is left > blank. I believe this is because XML requires date fields to have a value. Thats true - but you can use xforms:date instead of xs:date - this allows for empty values, too. HTH florian -- 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 |
In reply to this post by Dustin Henson-3
Dustin
I came across this on Orbeon's web pages: Support for XForms 1.1 types allowing empty content. Several built-in XML Schema data types, such as <xforms:bind nodeset="..." type="xforms:date"/>xs:date , do not consider an empty string as a valid value. This makes it difficult, for example, to specify the type "optional date" in XForms. With XForms 1.1, every built-in data type has a counterpart in the xforms namespace, which adds the empty string as a valid value. These types are now supported in Orbeon Forms. For example, you denote an optional date in an instance with: I believe you can use xforms:date for specifying an optional date. I have not tried it myself, but now that you have been having this problem with the date field, I need to address the same issue in my Xform as well. thanks ilango Dustin Henson <[hidden email]> wrote: Can anyone give me a pointer on how to make a date field optional, but still have a date control? Currently Orbeon displays an error on the page indicating the field is not formated properly when it is left blank. I believe this is because XML requires date fields to have a value.
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. -- 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 |
In reply to this post by fl.schmitt(ops-users)
Hi Can anyone help me in this,
I Have an input field where i have to enter date in mm/dd/yyyy format manually and the date must be lessthan or equal to currentdate, how can we restrict date format as mm/dd/yyyy and date must be lessthan or equal to currentdate. Thanks in advance, K Gopikrishna Reddy This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person. -- 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 winmail.dat (4K) Download Attachment |
Administrator
|
In reply to this post by Dustin Henson-3
Dustin,
You can use the XForms type xforms:date instead of xs:date. The only issue with that is that the calendar control doesn't have a "clear" button to remove the selected date once you picked it, but as a workaround you could have a separate "clear" button implemented with a trigger. -Erik On Mar 25, 2008, at 9:40 PM, Dustin Henson wrote: > Can anyone give me a pointer on how to make a date field optional, > but still have a date control? Currently Orbeon displays an error on > the page indicating the field is not formated properly when it is > left blank. I believe this is because XML requires date fields to > have a value. > > Below are the binding and field declaration sections of my page. The > file config-instance.xml declares the field to be optional. > > Binding: > <xforms:bind id="SI_PIExpirationDateBind" > type="xs:date" > nodeset="instance('default-instance')/ > IncidentInvolvedIdentityActivity/InvolvedIdentity/PIExpirationDate" > required="(instance('config-instance')/ > IncidentInvolvedIdentityActivity/InvolvedIdentity/PIExpirationDate = > 1)" /> > > Field: > <xforms:input bind="SI_PIExpirationDateBind"> > <xforms:label class="theftDetails-label">Expiration Date </ > xforms:label> > <xforms:help><b>Expiration Date: </b>The date the > Identification expires</xforms:help> > <xforms:alert>015: The Expiration date must be a valid date</ > xforms:alert> > <xforms:action ev:event="xforms-invalid" if="normalize- > space(event('alert')) != ''"> > <xforms:insert context="instance('errors-instance')" > nodeset="error" origin="instance('error-template')"/> > <xforms:setvalue ref="instance('errors-instance')/ > error[index('errors-repeat')]/@id" > value="substring(string(event('alert')),1,3)"/> > <xforms:setvalue ref="instance('errors-instance')/ > error[index('errors-repeat')]/@label" value="event('label')"/> > <xforms:setvalue ref="instance('errors-instance')/ > error[index('errors-repeat')]/@alert" > value="substring(string(event('alert')),7)"/> > </xforms:action> > <xforms:action ev:event="xforms-valid" if="instance('errors- > instance')/error[@id = substring(string(event('alert')),1,3)]"> > <xforms:delete nodeset="instance('errors-instance')/ > error[@id = substring(string(event('alert')),1,3)]"/> > </xforms:action> > </xforms:input> > I had a similar problem with numeric fields, but was able to resolve > it for them by changing the binding like this. Unfortunately I can't > do this for dates because I will loose the date control. > <xforms:bind id="SI_LocationPostalCodeIDBind" > type="xs:string" > nodeset="instance('default-instance')/ > IncidentInvolvedIdentityActivity/InvolvedIdentity/ > PIIssuingOrganization/OrganizationContactInfo/ContactMailingAddress/ > LocationPostalCodeID" > required="(instance('config-instance')/ > IncidentInvolvedIdentityActivity/InvolvedIdentity/ > PIIssuingOrganization/OrganizationContactInfo/ContactMailingAddress/ > LocationPostalCodeID = 1)" > constraint="(. = null) or (string-length(.) = 0) or (. > castable as xs:integer and string-length(.) = 5)" /> > > Thanks, > Dustin > > -- > 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 Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.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 |
In reply to this post by Reddy, Gopikrishna
Hi Can anyone help me in this,
I Have an input field where i have to enter date in mm/dd/yyyy format manually and the date must be lessthan or equal to currentdate, how can we restrict date format as mm/dd/yyyy and date must be lessthan or equal to currentdate.
Thanks in advance, K Gopikrishna Reddy This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person. |
In reply to this post by Dustin Henson-3
Dustin
Did you manage to solve your problem? -ilango
|
In reply to this post by Reddy, Gopikrishna
Hi Gopikrishna,
> I Have an input field where i have to enter date in mm/dd/yyyy format > manually and the date must be lessthan or equal to currentdate, how can we > restrict date format as mm/dd/yyyy and date must be lessthan or equal to > currentdate. This seems to be a little bit complex: - On the one hand, you want to have the date in a format divergent from the ISO 8610 specs - this is possible, of course. - On the other hand, you want to work with the date in a "date-specific" manner (comparison with current-date() function output). This could be easily done with XPath operators and functions - but requires the date to be available in standard format (as far as i know). So, i see two ways of solution: 1: Keep the date data in the format as you want - then it would be of xs:string type. You could use a regex as constraint to test whether it's a valid date in the desired syntax. To compare it to current-date(), you will have to transform it in a xs:date conformant syntax, i suppose. This can be done with regular expressions, too (and xpath functios replace() ). 2. Keep the data in the ISO format and apply a transformation only when it should appear in the outout in the format mm/dd/yyyy. This way, you have the full power of validation, xforms controls and date-specific xpath functions available to do comparisons etc. In my opinion, the second way is preferable. HTH florian -- 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 |
In reply to this post by Reddy, Gopikrishna
K,
[I presumed I had this code already tested, but some of this is untested...] Assuming "start-date" is grouped/referenced to the instance and element you want, this should format it : <xforms:input ref="start-date" xxforms:format="format-date(xs:date (.), '[M01]/[D01]/[Y]', 'en', (), ())"> <xforms:label> Start Date: </xforms:label> </xforms:input> And to insure that the dates don't cross over in time, <xforms:bind nodeset="instance('my-instance')" xmlns:xs="http:// www.w3.org/2001/XMLSchema"> <xforms:bind nodeset="start-date" type="xs:date" constraint"if ((. castable as xs:date) and (../end-date castable as xs:date)) then xs:date(.) <= xs:date(../end-date)" /> <xforms:bind nodeset="end-date" type="xs:date" constraint="[similar to above....]" /> </xforms:bind> e.g. Florian's idea #2. HTH, Hank On Mar 27, 2008, at 2:39 AM, Reddy, Gopikrishna wrote: > Hi Can anyone help me in this, > I Have an input field where i have to enter date in mm/dd/yyyy > format manually and the date must be lessthan or equal to > currentdate, how can we restrict date format as mm/dd/yyyy and > date must be lessthan or equal to currentdate. > > > Thanks in advance, > > K Gopikrishna Reddy > > This e-mail (and any attachments), is confidential and may be > privileged. It may be read, copied and used only by intended > recipients. Unauthorized access to this e-mail (or attachments) and > disclosure or copying of its contents or any action taken in > reliance on it is unlawful. Unintended recipients must notify the > sender immediately by e-mail/phone & delete it from their system > without making any copies or disclosing it to a third person. > > -- > 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 NEES@UCSB Institute for Crustal Studies, University of California, Santa Barbara 805-893-8042 -- 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 |
In reply to this post by Erik Bruchez
Thanks all. That did the trick. I have a follow on question though.
When other data types are required the background shows in red. However, the date button does not. Is there any way to have a similar indicator that a date field is required? -Dustin On Wed, Mar 26, 2008 at 7:50 AM, Erik Bruchez <[hidden email]> wrote: Dustin, -- 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 |
In reply to this post by Hank Ratzesberger
Hi Thanks for ur help this code works fine when i use
calender
but how can i make this work when i dont use calender as i
have to enter date manually in dd/mm/yyyy format and date must be lessthan
currentdate,Plz help me in this
Thanks in advance,
K Gopikrishna Reddy
From: Hank Ratzesberger
[mailto:[hidden email]]
Sent: Thu 3/27/2008 9:43 PM To: [hidden email] Subject: [ops-users] Re: FW: Date format as mm/dd/yyyy with input field K, This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person. |
Hi Gopikrishna, Again, not thoroughly tested, but if you bind to xs:string instead of xs:date, it should work. All the date comparisons are done in casts. Cheers, Hank On Mar 27, 2008, at 11:33 PM, Reddy, Gopikrishna wrote: > > Hi Thanks for ur help this code works fine when i use calender > but how can i make this work when i dont use calender as i have to > enter date manually in dd/mm/yyyy format and date must be lessthan > currentdate,Plz help me in this > > Thanks in advance, > K Gopikrishna Reddy > From: Hank Ratzesberger [mailto:[hidden email]] > Sent: Thu 3/27/2008 9:43 PM > To: [hidden email] > Subject: [ops-users] Re: FW: Date format as mm/dd/yyyy with input > field > > K, > > [I presumed I had this code already tested, but some of this is > untested...] > > Assuming "start-date" is grouped/referenced to the instance and > element you want, this should format it : > > <xforms:input ref="start-date" xxforms:format="format-date(xs:date > (.), '[M01]/[D01]/[Y]', 'en', (), ())"> > <xforms:label> Start Date: </xforms:label> > </xforms:input> > > And to insure that the dates don't cross over in time, > > <xforms:bind nodeset="instance('my-instance')" xmlns:xs="http:// > www.w3.org/2001/XMLSchema"> > <xforms:bind nodeset="start-date" type="xs:date" > constraint"if ((. castable as xs:date) and (../end-date castable > as xs:date)) then > xs:date(.) <= xs:date(../end-date)" /> > <xforms:bind nodeset="end-date" type="xs:date" > constraint="[similar to above....]" /> > </xforms:bind> > > e.g. Florian's idea #2. > > HTH, > Hank > > On Mar 27, 2008, at 2:39 AM, Reddy, Gopikrishna wrote: > > Hi Can anyone help me in this, > > I Have an input field where i have to enter date in mm/dd/yyyy > > format manually and the date must be lessthan or equal to > > currentdate, how can we restrict date format as mm/dd/yyyy and > > date must be lessthan or equal to currentdate. > > > > > > Thanks in advance, > > > > K Gopikrishna Reddy > > > > This e-mail (and any attachments), is confidential and may be > > privileged. It may be read, copied and used only by intended > > recipients. Unauthorized access to this e-mail (or attachments) and > > disclosure or copying of its contents or any action taken in > > reliance on it is unlawful. Unintended recipients must notify the > > sender immediately by e-mail/phone & delete it from their system > > without making any copies or disclosing it to a third person. > > > > -- > > 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 > > Hank Ratzesberger > NEES@UCSB > Institute for Crustal Studies, > University of California, Santa Barbara > 805-893-8042 > > > > > > > This e-mail (and any attachments), is confidential and may be > privileged. It may be read, copied and used only by intended > recipients. Unauthorized access to this e-mail (or attachments) and > disclosure or copying of its contents or any action taken in > reliance on it is unlawful. Unintended recipients must notify the > sender immediately by e-mail/phone & delete it from their system > without making any copies or disclosing it to a third person. NEES@UCSB Institute for Crustal Studies, University of California, Santa Barbara 805-893-8042 -- 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 |
Administrator
|
In reply to this post by Dustin Henson-2
Yes, you can do what you want with CSS, but that CSS is not present by
default in our xforms.css. So you will have to write your own. This should give you an idea of how we deal with other controls in xforms.css at the moment: .xforms-required-empty input, textarea.xforms-required-empty, input.xforms-required-empty { border: 1px solid #f99; background-color: #fcc; } Note that it is easy to be confused about the following: * The "required" model item property, * the "valid" model item property, * what happens when a value is required but empty, * xforms:alert, * and how all this is meant to work in the UI. We will try to provide explanations on all the above soon, as we have plans to enhance the way we deal with all of the above in Orbeon Forms soon. Right now, to be honest, things are far from ideal. -Erik On Mar 27, 2008, at 9:09 PM, Dustin Henson wrote: > Thanks all. That did the trick. I have a follow on question though. > > When other data types are required the background shows in red. > However, the date button does not. Is there any way to have a > similar indicator that a date field is required? > > -Dustin > > On Wed, Mar 26, 2008 at 7:50 AM, Erik Bruchez <[hidden email]> > wrote: > Dustin, > > You can use the XForms type xforms:date instead of xs:date. > > The only issue with that is that the calendar control doesn't have a > "clear" button to remove the selected date once you picked it, but > as a workaround you could have a separate "clear" button implemented > with a trigger. > > -Erik > > > On Mar 25, 2008, at 9:40 PM, Dustin Henson wrote: > > Can anyone give me a pointer on how to make a date field optional, > but still have a date control? Currently Orbeon displays an error on > the page indicating the field is not formated properly when it is > left blank. I believe this is because XML requires date fields to > have a value. > > Below are the binding and field declaration sections of my page. The > file config-instance.xml declares the field to be optional. > > Binding: > <xforms:bind id="SI_PIExpirationDateBind" > type="xs:date" > nodeset="instance('default-instance')/ > IncidentInvolvedIdentityActivity/InvolvedIdentity/PIExpirationDate" > required="(instance('config-instance')/ > IncidentInvolvedIdentityActivity/InvolvedIdentity/PIExpirationDate = > 1)" /> > > Field: > <xforms:input bind="SI_PIExpirationDateBind"> > <xforms:label class="theftDetails-label">Expiration Date </ > xforms:label> > <xforms:help><b>Expiration Date: </b>The date the Identification > expires</xforms:help> > <xforms:alert>015: The Expiration date must be a valid date</ > xforms:alert> > <xforms:action ev:event="xforms-invalid" if="normalize- > space(event('alert')) != ''"> > <xforms:insert context="instance('errors-instance')" > nodeset="error" origin="instance('error-template')"/> > <xforms:setvalue ref="instance('errors-instance')/ > error[index('errors-repeat')]/@id" > value="substring(string(event('alert')),1,3)"/> > <xforms:setvalue ref="instance('errors-instance')/ > error[index('errors-repeat')]/@label" value="event('label')"/> > <xforms:setvalue ref="instance('errors-instance')/ > error[index('errors-repeat')]/@alert" > value="substring(string(event('alert')),7)"/> > </xforms:action> > <xforms:action ev:event="xforms-valid" if="instance('errors- > instance')/error[@id = substring(string(event('alert')),1,3)]"> > <xforms:delete nodeset="instance('errors-instance')/error[@id > = substring(string(event('alert')),1,3)]"/> > </xforms:action> > </xforms:input> > I had a similar problem with numeric fields, but was able to resolve > it for them by changing the binding like this. Unfortunately I can't > do this for dates because I will loose the date control. > <xforms:bind id="SI_LocationPostalCodeIDBind" > type="xs:string" > nodeset="instance('default-instance')/ > IncidentInvolvedIdentityActivity/InvolvedIdentity/ > PIIssuingOrganization/OrganizationContactInfo/ContactMailingAddress/ > LocationPostalCodeID" > required="(instance('config-instance')/ > IncidentInvolvedIdentityActivity/InvolvedIdentity/ > PIIssuingOrganization/OrganizationContactInfo/ContactMailingAddress/ > LocationPostalCodeID = 1)" > constraint="(. = null) or (string-length(.) = 0) or (. > castable as xs:integer and string-length(.) = 5)" /> > > Thanks, > Dustin > > -- > 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 > > -- > Orbeon Forms - Web Forms for the Enterprise Done the Right Way > http://www.orbeon.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 Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.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 |
Free forum by Nabble | Edit this page |