jeromyevans / struts2yuiplugin

JSP Tags for Struts2 that create active YUI components
0 stars 0 forks source link

namespace errors given if id value has any dots (".") in it. #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add a control to the form with an id value containing a dot
2. Try to use the control.

What is the expected output? What do you see instead?
Popup calendar should be shown. Instead, errors appear in the JavaScript
console.

What version of the product are you using? On what operating system?
0.1alpha4

Please provide any additional information below.
Firefox 2.x

The parser should replace dots in ID values (and any other reserved or
meaningful JavaScript characters) before injecting into the JavaScript.

Original issue reported on code.google.com by mcal...@gmail.com on 11 Feb 2008 at 5:17

GoogleCodeExporter commented 9 years ago
Developers, this can be corrected by editing DatePicker.java (Lines 156 - 166)
setters for id and name. Just pass them through the 
YUITools.sanitizeForJavascript
method as shown below:

    @Override
    @StrutsTagAttribute(description = "Used as HTML id attribute", required = true)
    public void setId(String id) {
        super.setId(YUITools.sanitizeForJavascript(id));
    }

    @Override
    @StrutsTagAttribute(description = "Name of the field that will cotainf the date
value", required = true)
    public void setName(String name) {
        super.setName(YUITools.sanitizeForJavascript(name));
    }

I have made the change and tested it in my local environment. The
sanitizeForJavascript method already replaces dots with underscores, so you 
have what
you need.

Original comment by cody.bur...@gmail.com on 30 Mar 2009 at 4:35

GoogleCodeExporter commented 9 years ago
Resolved as "Fixed" (see revision 13 'Fix for Issue 5')

Original comment by cody.bur...@gmail.com on 2 Apr 2009 at 9:57