Hi ,
I have a date input field where ihave to enter date
manually iam giving the bind as follows
<xforms:bind
nodeset="instance('main-instance')//mecclatasgstrteffdt" type="xs:string"
constraint="if (. !='' ) then (. < (current-date()) and
format-date(xs:date(.),'[M01]/[D01]/[Y0001]') ) else ''"/>
As this works fine but it is accepting date only in YYYY-DD-MM
FORMAT but i need in MM/DD/YYYY format can anybody
please help as this is very urgent to me.
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. |
Hi,
> <xforms:bind > nodeset="instance('main-instance')//mecclatasgstrteffdt" > type="xs:string" > constraint="if (. !='' ) > then ( > . < (current-date()) > and format-date(xs:date(.),'[M01]/[D01]/[Y0001]') > ) else '' > "/> > As this works fine but it is accepting date only in *YYYY-DD-MM FORMAT* > but i need in *MM/DD/YYYY* format can anybody please help as this is > very urgent to me. I think it works only with YYYY-MM-DD formats because xs:date() will work only with a date string written using that syntax. I suppose you will have to use a regular expression to transform the current string value into a string that suits that syntax. You could use something like this: replace(//data, '(\d{2})\/(\d{2})\/(\d{4})', '$3-$2-$1') (didn't test it exhaustively) This should take the value of node //data, capture the numerical values and create a string with the numerical values in reverse order and divided by a '-'. The result of the replace function should first get tested whether it's castable to xs:date. Maybe you could rewrite the bind element as follows (again, not tested): <xforms:bind nodeset="instance('main-instance')//mydate" type="xs:string" constraint="if (. !='' ) then ( if (replace(//mydate, '(\d{2})\/(\d{2})\/(\d{4})', '$3-$2-$1') castable as xs:date) then (xs:date(replace(//mydate,'(\d{2})\/(\d{2})\/(\d{4})','$3-$2-$1')) < (current-date())) else false() ) else false()" /> Instead of using the replace function twice, you could create an additional element in your instance that will hold the date in ISO format by calculating its value: <xforms:bind nodeset="//iso-date" type="xs:string" calculate=" replace( //mydate, '(\d{2})\/(\d{2})\/(\d{4})', '$3-$2-$1' )" /> (Maybe, iso-date could be set to type xs:date already) Then you could reference this element in the constraint: <xforms:bind nodeset="instance('main-instance')//mydate" type="xs:string" constraint="if (. !='' ) then ( if (//iso-date castable as xs:date) then (xs:date(//iso-date) < (current-date())) else false() ) else false()" /> But i don't know whether this will work - you will have to test it. 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 |
Hi Thanks for the help but
this doesnt work as iam getting error
Error at character 8 in regular expression "(\d{2})\/(\d{2})\/(\d{4})": invalid escape sequence CAN ANYBODY PLEASE HELP AS THIS IS VERY URGENT TOM E
Thanks in advance, K Gopikrishna Reddy
From: Florian Schmitt [mailto:[hidden email]] Sent: Tue 4/1/2008 2:35 PM To: [hidden email] Subject: [ops-users] Re: RE:DATE INPUT FIELD +MM/DD/YYYY FORMAT AND LESS THAN CURRENT DATE Hi, 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, Did you try removing the \ before / ? I don't think / needs to be escaped in Java regex (as it does for Perl). HTH, Hank On Apr 1, 2008, at 7:56 AM, Reddy, Gopikrishna wrote: > Hi Thanks for the help but this doesnt work as iam getting error > > Error at character 8 in regular expression "(\d{2})\/(\d{2})\/(\d > {4})": invalid escape sequence > > CAN ANYBODY PLEASE HELP AS THIS IS VERY URGENT TOM E > > > > Thanks in advance, > > K Gopikrishna Reddy > > > > > From: Florian Schmitt [mailto:[hidden email]] > Sent: Tue 4/1/2008 2:35 PM > To: [hidden email] > Subject: [ops-users] Re: RE:DATE INPUT FIELD +MM/DD/YYYY FORMAT AND > LESS THAN CURRENT DATE > > Hi, > > > <xforms:bind > > nodeset="instance('main-instance')//mecclatasgstrteffdt" > > type="xs:string" > > constraint="if (. !='' ) > > then ( > > . < (current-date()) > > and format-date(xs:date(.),'[M01]/[D01]/[Y0001]') > > ) else '' > > "/> > > > As this works fine but it is accepting date only in *YYYY-DD-MM > FORMAT* > > but i need in *MM/DD/YYYY* format can anybody please help as this is > > very urgent to me. > > I think it works only with YYYY-MM-DD formats because xs:date() will > work only with a date string written using that syntax. I suppose you > will have to use a regular expression to transform the current string > value into a string that suits that syntax. You could use something > like > this: > > replace(//data, '(\d{2})\/(\d{2})\/(\d{4})', '$3-$2-$1') > > (didn't test it exhaustively) > > This should take the value of node //data, capture the numerical > values > and create a string with the numerical values in reverse order and > divided by a '-'. The result of the replace function should first get > tested whether it's castable to xs:date. > > > Maybe you could rewrite the bind element as follows (again, not > tested): > > <xforms:bind > nodeset="instance('main-instance')//mydate" > type="xs:string" > constraint="if (. !='' ) > then ( > if (replace(//mydate, '(\d{2})\/(\d{2})\/(\d{4})', > '$3-$2-$1') castable as xs:date) > then > (xs:date(replace(//mydate,'(\d{2})\/(\d{2})\/(\d{4})','$3-$2-$1')) > < > (current-date())) > else false() > ) else false()" > /> > > Instead of using the replace function twice, you could create an > additional element in your instance that will hold the date in ISO > format by calculating its value: > > <xforms:bind > nodeset="//iso-date" > type="xs:string" > calculate=" > replace( > //mydate, > '(\d{2})\/(\d{2})\/(\d{4})', > '$3-$2-$1' > )" > /> > > (Maybe, iso-date could be set to type xs:date already) > > Then you could reference this element in the constraint: > > <xforms:bind > nodeset="instance('main-instance')//mydate" > type="xs:string" > constraint="if (. !='' ) > then ( > if (//iso-date castable as xs:date) > then (xs:date(//iso-date) < (current-date())) > else false() > ) else false()" > /> > > But i don't know whether this will work - you will have to test it. > > > HTH > florian > > > 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. > <message-footer.txt> > > -- > 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 |
Hi I tried removing the \ before / but iam getting
alert which is not disappearing even if i enetered less than current date plz
help me in this as it is very uregnt to me
Thanks in advance,
K Gopikrishna Reddy From: Hank Ratzesberger [mailto:[hidden email]] Sent: Tue 4/1/2008 9:27 PM To: [hidden email] Subject: [ops-users] Re: FW: Re: RE:DATE INPUT FIELD +MM/DD/YYYY FORMAT AND LESS THAN CURRENT DATE Hi, 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 Reddy, Gopikrishna
Hi Joshi ,
Thanks for ur reply can u provide the java
program how u included it will be very helpful to me
Thanks in advance,
K Gopikrishna Reddy From: Naman Joshi [mailto:[hidden email]] Sent: Wed 4/2/2008 8:09 AM To: Reddy, Gopikrishna Subject: RE: [ops-users] FW: Re: RE:DATE INPUT FIELD +MM/DD/YYYY FORMAT AND LESS THAN CURRENT DATE Reddy,
I had a similar problem. I solved it by just creating a simple Java program and then adding that in the xmlns declaration at the top.
Let me know if you still need help.
Cheers, Naman
From: Reddy, Gopikrishna
[mailto:[hidden email]]
Hi Thanks for the help but this doesnt work as iam getting error
Error at character 8 in regular expression "(\d{2})\/(\d{2})\/(\d{4})": invalid escape sequence CAN ANYBODY PLEASE HELP AS THIS IS VERY URGENT TOM E
Thanks in advance, K Gopikrishna Reddy
From: Florian Schmitt
[mailto:[hidden email]] Hi, NOTICE This e-mail and any attachments are confidential and may contain copyright material of Macquarie Group Limited or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Group Limited does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Group Limited.
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.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 Reddy, Gopikrishna
Hi,
> Hi I tried removing the \ before / but iam getting alert which is not > disappearing even if i enetered less than current date plz help me in > this as it is very uregnt to me it will appear as soon as the input control loses focus. You can also add the incremental="true" attribute to the xforms:input, so the content will be revalidated more often. I've attached an example. 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 date.xhtml (1K) Download Attachment |
In reply to this post by Hank Ratzesberger
Hi,
> Did you try removing the \ before / ? > > I don't think / needs to be escaped in Java regex (as it > does for Perl). that's right - my fault. I tested the replace function in XMLSpy, and it worked there with the slashes escaped. So i thought it would be correct that way. Sorry! 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 |
Free forum by Nabble | Edit this page |