You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Laurie Harper <la...@holoweb.net> on 2005/11/03 23:06:32 UTC

[validator] Date validation issues

I'm using Validator in a Struts project and I'm having some problems 
with client-side date validation. Specifically, in validateDate:

- it only accepts numeric input (i.e. it can match '01 01 2006', but not 
'01 Jan 2006')

- it doesn't pay attention to the date format; it can only match 
variants on 'dd MM yyyy'; any other characters/strings besides 'dd', 
'MM', 'yyyy' get treated as static seperator characters. For example, 
'dd MMM yyyy' matchs '01 01M2006'!

I'm basing this on the Javascript generated by Struts' html:javascript 
tag. Is there something special I need to be doing to get Validator to 
generate client-side validation code that's properly in sync with the 
date pattern, or is it really just this limitted?

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [validator] Date validation issues

Posted by Laurie Harper <la...@holoweb.net>.
Frank W. Zammetti wrote:
> D'oh!  I didn't read the license header :)
> 
> But, it does say you can use it for any use... I would consider, AHEM,
> "inspiration", to be one such use :)

LOL :)


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [validator] Date validation issues

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
D'oh!  I didn't read the license header :)

But, it does say you can use it for any use... I would consider, AHEM,
"inspiration", to be one such use :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

On Fri, November 4, 2005 3:18 pm, Laurie Harper said:
> Nice; now can you find one that allows redistribution? ;-)
>
> Frank W. Zammetti wrote:
>> Might this help?
>>
>> http://www.mattkruse.com/javascript/date/source.html
>>
>> Frank
>>
>> Niall Pemberton wrote:
>>
>>> The main issue with this is going to be how to handle text for
>>> different
>>> locales.
>>>
>>> Niall
>>>
>>> ----- Original Message ----- From: "Don Brown" <do...@gmail.com>
>>> Sent: Thursday, November 03, 2005 10:34 PM
>>>
>>>
>>> This is a limitation based on the fact that the entire SimpleDateFormat
>>> pattern matching engine hasn't been ported to Javascript. If you want
>>> to
>>> open up a ticket and perhaps add a patch, I'll be very happy to
>>> include full
>>> support :)
>>>
>>> Don
>>>
>>> On 11/3/05, Laurie Harper <la...@holoweb.net> wrote:
>>>
>>>> I'm using Validator in a Struts project and I'm having some problems
>>>> with client-side date validation. Specifically, in validateDate:
>>>>
>>>> - it only accepts numeric input (i.e. it can match '01 01 2006', but
>>>> not
>>>> '01 Jan 2006')
>>>>
>>>> - it doesn't pay attention to the date format; it can only match
>>>> variants on 'dd MM yyyy'; any other characters/strings besides 'dd',
>>>> 'MM', 'yyyy' get treated as static seperator characters. For example,
>>>> 'dd MMM yyyy' matchs '01 01M2006'!
>>>>
>>>> I'm basing this on the Javascript generated by Struts' html:javascript
>>>> tag. Is there something special I need to be doing to get Validator to
>>>> generate client-side validation code that's properly in sync with the
>>>> date pattern, or is it really just this limitted?
>>>>
>>>> L.
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>>
>>>
>>> .
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [validator] Date validation issues

Posted by Laurie Harper <la...@holoweb.net>.
Nice; now can you find one that allows redistribution? ;-)

Frank W. Zammetti wrote:
> Might this help?
> 
> http://www.mattkruse.com/javascript/date/source.html
> 
> Frank
> 
> Niall Pemberton wrote:
> 
>> The main issue with this is going to be how to handle text for different
>> locales.
>>
>> Niall
>>
>> ----- Original Message ----- From: "Don Brown" <do...@gmail.com>
>> Sent: Thursday, November 03, 2005 10:34 PM
>>
>>
>> This is a limitation based on the fact that the entire SimpleDateFormat
>> pattern matching engine hasn't been ported to Javascript. If you want to
>> open up a ticket and perhaps add a patch, I'll be very happy to 
>> include full
>> support :)
>>
>> Don
>>
>> On 11/3/05, Laurie Harper <la...@holoweb.net> wrote:
>>
>>> I'm using Validator in a Struts project and I'm having some problems
>>> with client-side date validation. Specifically, in validateDate:
>>>
>>> - it only accepts numeric input (i.e. it can match '01 01 2006', but not
>>> '01 Jan 2006')
>>>
>>> - it doesn't pay attention to the date format; it can only match
>>> variants on 'dd MM yyyy'; any other characters/strings besides 'dd',
>>> 'MM', 'yyyy' get treated as static seperator characters. For example,
>>> 'dd MMM yyyy' matchs '01 01M2006'!
>>>
>>> I'm basing this on the Javascript generated by Struts' html:javascript
>>> tag. Is there something special I need to be doing to get Validator to
>>> generate client-side validation code that's properly in sync with the
>>> date pattern, or is it really just this limitted?
>>>
>>> L.
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>>
>> .
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [validator] Date validation issues

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Might this help?

http://www.mattkruse.com/javascript/date/source.html

Frank

Niall Pemberton wrote:
> The main issue with this is going to be how to handle text for different
> locales.
> 
> Niall
> 
> ----- Original Message ----- 
> From: "Don Brown" <do...@gmail.com>
> Sent: Thursday, November 03, 2005 10:34 PM
> 
> 
> This is a limitation based on the fact that the entire SimpleDateFormat
> pattern matching engine hasn't been ported to Javascript. If you want to
> open up a ticket and perhaps add a patch, I'll be very happy to include full
> support :)
> 
> Don
> 
> On 11/3/05, Laurie Harper <la...@holoweb.net> wrote:
> 
>>I'm using Validator in a Struts project and I'm having some problems
>>with client-side date validation. Specifically, in validateDate:
>>
>>- it only accepts numeric input (i.e. it can match '01 01 2006', but not
>>'01 Jan 2006')
>>
>>- it doesn't pay attention to the date format; it can only match
>>variants on 'dd MM yyyy'; any other characters/strings besides 'dd',
>>'MM', 'yyyy' get treated as static seperator characters. For example,
>>'dd MMM yyyy' matchs '01 01M2006'!
>>
>>I'm basing this on the Javascript generated by Struts' html:javascript
>>tag. Is there something special I need to be doing to get Validator to
>>generate client-side validation code that's properly in sync with the
>>date pattern, or is it really just this limitted?
>>
>>L.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 
> .
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [validator] Date validation issues

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
The main issue with this is going to be how to handle text for different
locales.

Niall

----- Original Message ----- 
From: "Don Brown" <do...@gmail.com>
Sent: Thursday, November 03, 2005 10:34 PM


This is a limitation based on the fact that the entire SimpleDateFormat
pattern matching engine hasn't been ported to Javascript. If you want to
open up a ticket and perhaps add a patch, I'll be very happy to include full
support :)

Don

On 11/3/05, Laurie Harper <la...@holoweb.net> wrote:
>
> I'm using Validator in a Struts project and I'm having some problems
> with client-side date validation. Specifically, in validateDate:
>
> - it only accepts numeric input (i.e. it can match '01 01 2006', but not
> '01 Jan 2006')
>
> - it doesn't pay attention to the date format; it can only match
> variants on 'dd MM yyyy'; any other characters/strings besides 'dd',
> 'MM', 'yyyy' get treated as static seperator characters. For example,
> 'dd MMM yyyy' matchs '01 01M2006'!
>
> I'm basing this on the Javascript generated by Struts' html:javascript
> tag. Is there something special I need to be doing to get Validator to
> generate client-side validation code that's properly in sync with the
> date pattern, or is it really just this limitted?
>
> L.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [validator] Date validation issues

Posted by Laurie Harper <la...@holoweb.net>.
Ah, OK. I'll add it to my todo list ;-) As a work-around, is there any 
way to configure a validator rule but turn off it's client-side 
validation (i.e. so I can still use the 'date' rule, but only apply it 
server-side while retaining client-side validation for everything else)?

At the very least I'll look at how easy it may be to detect whether the 
date format specification is 'compatible' with the existing validation 
logic and execute it conditionally on that.

L.

Don Brown wrote:
> This is a limitation based on the fact that the entire SimpleDateFormat
> pattern matching engine hasn't been ported to Javascript. If you want to
> open up a ticket and perhaps add a patch, I'll be very happy to include full
> support :)
> 
> Don
> 
> On 11/3/05, Laurie Harper <la...@holoweb.net> wrote:
> 
>>I'm using Validator in a Struts project and I'm having some problems
>>with client-side date validation. Specifically, in validateDate:
>>
>>- it only accepts numeric input (i.e. it can match '01 01 2006', but not
>>'01 Jan 2006')
>>
>>- it doesn't pay attention to the date format; it can only match
>>variants on 'dd MM yyyy'; any other characters/strings besides 'dd',
>>'MM', 'yyyy' get treated as static seperator characters. For example,
>>'dd MMM yyyy' matchs '01 01M2006'!
>>
>>I'm basing this on the Javascript generated by Struts' html:javascript
>>tag. Is there something special I need to be doing to get Validator to
>>generate client-side validation code that's properly in sync with the
>>date pattern, or is it really just this limitted?
>>
>>L.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [validator] Date validation issues

Posted by Don Brown <do...@gmail.com>.
This is a limitation based on the fact that the entire SimpleDateFormat
pattern matching engine hasn't been ported to Javascript. If you want to
open up a ticket and perhaps add a patch, I'll be very happy to include full
support :)

Don

On 11/3/05, Laurie Harper <la...@holoweb.net> wrote:
>
> I'm using Validator in a Struts project and I'm having some problems
> with client-side date validation. Specifically, in validateDate:
>
> - it only accepts numeric input (i.e. it can match '01 01 2006', but not
> '01 Jan 2006')
>
> - it doesn't pay attention to the date format; it can only match
> variants on 'dd MM yyyy'; any other characters/strings besides 'dd',
> 'MM', 'yyyy' get treated as static seperator characters. For example,
> 'dd MMM yyyy' matchs '01 01M2006'!
>
> I'm basing this on the Javascript generated by Struts' html:javascript
> tag. Is there something special I need to be doing to get Validator to
> generate client-side validation code that's properly in sync with the
> date pattern, or is it really just this limitted?
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>