You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "David Webb (JIRA)" <ji...@apache.org> on 2009/07/29 18:38:59 UTC

[jira] Created: (STR-3193) Locale Date Validation with Client Side Javascript

Locale Date Validation with Client Side Javascript
--------------------------------------------------

                 Key: STR-3193
                 URL: https://issues.apache.org/struts/browse/STR-3193
             Project: Struts 1
          Issue Type: Bug
          Components: Tag Libraries
    Affects Versions: 1.3.10
         Environment: Windows XP or Suse 10.2, JBoss 4.2.3, Struts 1.3.10, JDK1.5_16
            Reporter: David Webb


This bug has to do with the struts-taglib package, specifically the code generated by <html:javascript> which comes from the org.apache.struts.taglib.html.JavascriptValidatorTag class.

My implementation of the patch may not be the most effective way to accomplish this, but the bug prevents a true Locale specific implementation of Forms with Dates.

>From the Struts Validation Documentation (which holds true on the server side validation):
"If no pattern is specified the default short date format is assumed."

However, if you define a Form Field as a "date" with no pattern, the client side javascript does not render the datePattern in the javascript and causes a clientside js NPE when checking the length of this.datePattern.

I have added an additional method for formatting the Locale SHORT date format to fill out in the MM, dd, and yyyy elements required by the static javascript generator from the Commons-Validator project.

The real patch is when looping over form fields from validation.xml.  I check if it is a type "date" then keep track of whether or not a var named "datePattern" exists.  If not, I add datePattern based on the Local passed in.

Please let me know if I can help. This is a really important feature for my application.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STR-3193) Locale Date Validation with Client Side Javascript

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46890#action_46890 ] 

Paul Benedict commented on STR-3193:
------------------------------------

David, thanks for the patch. I will look into this.

> Locale Date Validation with Client Side Javascript
> --------------------------------------------------
>
>                 Key: STR-3193
>                 URL: https://issues.apache.org/struts/browse/STR-3193
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Tag Libraries
>    Affects Versions: 1.3.10
>         Environment: Windows XP or Suse 10.2, JBoss 4.2.3, Struts 1.3.10, JDK1.5_16
>            Reporter: David Webb
>            Assignee: Paul Benedict
>             Fix For: Pending Review
>
>         Attachments: JavascriptValidatorTag.java.patch, Struts.patch
>
>
> This bug has to do with the struts-taglib package, specifically the code generated by <html:javascript> which comes from the org.apache.struts.taglib.html.JavascriptValidatorTag class.
> My implementation of the patch may not be the most effective way to accomplish this, but the bug prevents a true Locale specific implementation of Forms with Dates.
> From the Struts Validation Documentation (which holds true on the server side validation):
> "If no pattern is specified the default short date format is assumed."
> However, if you define a Form Field as a "date" with no pattern, the client side javascript does not render the datePattern in the javascript and causes a clientside js NPE when checking the length of this.datePattern.
> I have added an additional method for formatting the Locale SHORT date format to fill out in the MM, dd, and yyyy elements required by the static javascript generator from the Commons-Validator project.
> The real patch is when looping over form fields from validation.xml.  I check if it is a type "date" then keep track of whether or not a var named "datePattern" exists.  If not, I add datePattern based on the Local passed in.
> Please let me know if I can help. This is a really important feature for my application.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (STR-3193) Locale Date Validation with Client Side Javascript

Posted by "David Webb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/STR-3193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Webb updated STR-3193:
----------------------------

    Attachment: Struts.patch
                JavascriptValidatorTag.java.patch

2 pathes.  One from branch level and other from file level.

> Locale Date Validation with Client Side Javascript
> --------------------------------------------------
>
>                 Key: STR-3193
>                 URL: https://issues.apache.org/struts/browse/STR-3193
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Tag Libraries
>    Affects Versions: 1.3.10
>         Environment: Windows XP or Suse 10.2, JBoss 4.2.3, Struts 1.3.10, JDK1.5_16
>            Reporter: David Webb
>         Attachments: JavascriptValidatorTag.java.patch, Struts.patch
>
>
> This bug has to do with the struts-taglib package, specifically the code generated by <html:javascript> which comes from the org.apache.struts.taglib.html.JavascriptValidatorTag class.
> My implementation of the patch may not be the most effective way to accomplish this, but the bug prevents a true Locale specific implementation of Forms with Dates.
> From the Struts Validation Documentation (which holds true on the server side validation):
> "If no pattern is specified the default short date format is assumed."
> However, if you define a Form Field as a "date" with no pattern, the client side javascript does not render the datePattern in the javascript and causes a clientside js NPE when checking the length of this.datePattern.
> I have added an additional method for formatting the Locale SHORT date format to fill out in the MM, dd, and yyyy elements required by the static javascript generator from the Commons-Validator project.
> The real patch is when looping over form fields from validation.xml.  I check if it is a type "date" then keep track of whether or not a var named "datePattern" exists.  If not, I add datePattern based on the Local passed in.
> Please let me know if I can help. This is a really important feature for my application.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STR-3193) Locale Date Validation with Client Side Javascript

Posted by "David Webb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47253#action_47253 ] 

David Webb commented on STR-3193:
---------------------------------

That sounds fine.  The important thing is that is uses a standard pattern that the validator can use.  Thanks.

> Locale Date Validation with Client Side Javascript
> --------------------------------------------------
>
>                 Key: STR-3193
>                 URL: https://issues.apache.org/struts/browse/STR-3193
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Tag Libraries
>    Affects Versions: 1.3.10
>         Environment: Windows XP or Suse 10.2, JBoss 4.2.3, Struts 1.3.10, JDK1.5_16
>            Reporter: David Webb
>            Assignee: Paul Benedict
>             Fix For: Pending Review
>
>         Attachments: JavascriptValidatorTag.java.patch, Struts.patch
>
>
> This bug has to do with the struts-taglib package, specifically the code generated by <html:javascript> which comes from the org.apache.struts.taglib.html.JavascriptValidatorTag class.
> My implementation of the patch may not be the most effective way to accomplish this, but the bug prevents a true Locale specific implementation of Forms with Dates.
> From the Struts Validation Documentation (which holds true on the server side validation):
> "If no pattern is specified the default short date format is assumed."
> However, if you define a Form Field as a "date" with no pattern, the client side javascript does not render the datePattern in the javascript and causes a clientside js NPE when checking the length of this.datePattern.
> I have added an additional method for formatting the Locale SHORT date format to fill out in the MM, dd, and yyyy elements required by the static javascript generator from the Commons-Validator project.
> The real patch is when looping over form fields from validation.xml.  I check if it is a type "date" then keep track of whether or not a var named "datePattern" exists.  If not, I add datePattern based on the Local passed in.
> Please let me know if I can help. This is a really important feature for my application.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STR-3193) Locale Date Validation with Client Side Javascript

Posted by "Maciej M (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47254#action_47254 ] 

Maciej M commented on STR-3193:
-------------------------------

I've voted for it so let's wait for the fix.

> Locale Date Validation with Client Side Javascript
> --------------------------------------------------
>
>                 Key: STR-3193
>                 URL: https://issues.apache.org/struts/browse/STR-3193
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Tag Libraries
>    Affects Versions: 1.3.10
>         Environment: Windows XP or Suse 10.2, JBoss 4.2.3, Struts 1.3.10, JDK1.5_16
>            Reporter: David Webb
>            Assignee: Paul Benedict
>             Fix For: Pending Review
>
>         Attachments: JavascriptValidatorTag.java.patch, Struts.patch
>
>
> This bug has to do with the struts-taglib package, specifically the code generated by <html:javascript> which comes from the org.apache.struts.taglib.html.JavascriptValidatorTag class.
> My implementation of the patch may not be the most effective way to accomplish this, but the bug prevents a true Locale specific implementation of Forms with Dates.
> From the Struts Validation Documentation (which holds true on the server side validation):
> "If no pattern is specified the default short date format is assumed."
> However, if you define a Form Field as a "date" with no pattern, the client side javascript does not render the datePattern in the javascript and causes a clientside js NPE when checking the length of this.datePattern.
> I have added an additional method for formatting the Locale SHORT date format to fill out in the MM, dd, and yyyy elements required by the static javascript generator from the Commons-Validator project.
> The real patch is when looping over form fields from validation.xml.  I check if it is a type "date" then keep track of whether or not a var named "datePattern" exists.  If not, I add datePattern based on the Local passed in.
> Please let me know if I can help. This is a really important feature for my application.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (STR-3193) Locale Date Validation with Client Side Javascript

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/STR-3193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated STR-3193:
-------------------------------

    Fix Version/s: Pending Review

> Locale Date Validation with Client Side Javascript
> --------------------------------------------------
>
>                 Key: STR-3193
>                 URL: https://issues.apache.org/struts/browse/STR-3193
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Tag Libraries
>    Affects Versions: 1.3.10
>         Environment: Windows XP or Suse 10.2, JBoss 4.2.3, Struts 1.3.10, JDK1.5_16
>            Reporter: David Webb
>            Assignee: Paul Benedict
>             Fix For: Pending Review
>
>         Attachments: JavascriptValidatorTag.java.patch, Struts.patch
>
>
> This bug has to do with the struts-taglib package, specifically the code generated by <html:javascript> which comes from the org.apache.struts.taglib.html.JavascriptValidatorTag class.
> My implementation of the patch may not be the most effective way to accomplish this, but the bug prevents a true Locale specific implementation of Forms with Dates.
> From the Struts Validation Documentation (which holds true on the server side validation):
> "If no pattern is specified the default short date format is assumed."
> However, if you define a Form Field as a "date" with no pattern, the client side javascript does not render the datePattern in the javascript and causes a clientside js NPE when checking the length of this.datePattern.
> I have added an additional method for formatting the Locale SHORT date format to fill out in the MM, dd, and yyyy elements required by the static javascript generator from the Commons-Validator project.
> The real patch is when looping over form fields from validation.xml.  I check if it is a type "date" then keep track of whether or not a var named "datePattern" exists.  If not, I add datePattern based on the Local passed in.
> Please let me know if I can help. This is a really important feature for my application.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STR-3193) Locale Date Validation with Client Side Javascript

Posted by "Maciej M (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47251#action_47251 ] 

Maciej M commented on STR-3193:
-------------------------------

David shouldn't we use DateFormat.DEFAULT instead of SHORT, we wan't to have default pattern.

> Locale Date Validation with Client Side Javascript
> --------------------------------------------------
>
>                 Key: STR-3193
>                 URL: https://issues.apache.org/struts/browse/STR-3193
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Tag Libraries
>    Affects Versions: 1.3.10
>         Environment: Windows XP or Suse 10.2, JBoss 4.2.3, Struts 1.3.10, JDK1.5_16
>            Reporter: David Webb
>            Assignee: Paul Benedict
>             Fix For: Pending Review
>
>         Attachments: JavascriptValidatorTag.java.patch, Struts.patch
>
>
> This bug has to do with the struts-taglib package, specifically the code generated by <html:javascript> which comes from the org.apache.struts.taglib.html.JavascriptValidatorTag class.
> My implementation of the patch may not be the most effective way to accomplish this, but the bug prevents a true Locale specific implementation of Forms with Dates.
> From the Struts Validation Documentation (which holds true on the server side validation):
> "If no pattern is specified the default short date format is assumed."
> However, if you define a Form Field as a "date" with no pattern, the client side javascript does not render the datePattern in the javascript and causes a clientside js NPE when checking the length of this.datePattern.
> I have added an additional method for formatting the Locale SHORT date format to fill out in the MM, dd, and yyyy elements required by the static javascript generator from the Commons-Validator project.
> The real patch is when looping over form fields from validation.xml.  I check if it is a type "date" then keep track of whether or not a var named "datePattern" exists.  If not, I add datePattern based on the Local passed in.
> Please let me know if I can help. This is a really important feature for my application.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (STR-3193) Locale Date Validation with Client Side Javascript

Posted by "David Webb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/STR-3193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Webb reassigned STR-3193:
-------------------------------

    Assignee: Paul Benedict

Per your request from the mailing list.  Here is the Bug I was asking about.

> Locale Date Validation with Client Side Javascript
> --------------------------------------------------
>
>                 Key: STR-3193
>                 URL: https://issues.apache.org/struts/browse/STR-3193
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Tag Libraries
>    Affects Versions: 1.3.10
>         Environment: Windows XP or Suse 10.2, JBoss 4.2.3, Struts 1.3.10, JDK1.5_16
>            Reporter: David Webb
>            Assignee: Paul Benedict
>         Attachments: JavascriptValidatorTag.java.patch, Struts.patch
>
>
> This bug has to do with the struts-taglib package, specifically the code generated by <html:javascript> which comes from the org.apache.struts.taglib.html.JavascriptValidatorTag class.
> My implementation of the patch may not be the most effective way to accomplish this, but the bug prevents a true Locale specific implementation of Forms with Dates.
> From the Struts Validation Documentation (which holds true on the server side validation):
> "If no pattern is specified the default short date format is assumed."
> However, if you define a Form Field as a "date" with no pattern, the client side javascript does not render the datePattern in the javascript and causes a clientside js NPE when checking the length of this.datePattern.
> I have added an additional method for formatting the Locale SHORT date format to fill out in the MM, dd, and yyyy elements required by the static javascript generator from the Commons-Validator project.
> The real patch is when looping over form fields from validation.xml.  I check if it is a type "date" then keep track of whether or not a var named "datePattern" exists.  If not, I add datePattern based on the Local passed in.
> Please let me know if I can help. This is a really important feature for my application.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.