Your attribute break w3c standard and considering you're going to realize a cms and not an intranet, you should avoid such non-standard elements. In order to accomplish what you need I use to assign css classes: input type ="text" class ="data-length-50" ... After I handle it with jquery.
Maurizio Cucchiara On Dec 17, 2010 11:32 PM, "Scott Koenig" <scott.l.koe...@gmail.com> wrote: Hello, I am trying to add a character countdown to certain fields in the CMS I work on. The key is that I only want it to apply to certain fields for certain asset types. So, in our DB model, both asset A and asset B use the Headline field, but only asset A needs to worry about SEO and the 50-character target length we're shooting for. So, in asset A I have <content:headline label="Headline" required="true" targetChar="50"/> Whereas in asset B it's just <content:headline label="Title" required="true"/> Inside headline.tag I have <s:set var="id" value="'content.headline'" /> <s:set var="name" value="'content.headline'" /> <%@ attribute name="targetChar"%> <s:textfield id="%{#id}" name="%{#name}" data-targetChar="${targetChar}"/> which generates <input type="text" data-targetChar="50" id="content.headline" name="content.headline"> on the page for asset A, and the JavaScript takes over from there. However, when I try to load asset B, I get a compilation error, the relevant portion of which appears to be javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: Expression parameters.dynamicAttributes[aKey] is undefined on line 26, column 13 in template/simple/dynamic-attributes.ftl. - Class: freemarker.core.TemplateObject File: TemplateObject.java Method: assertNonNull Line: 124 - freemarker/core/TemplateObject.java:124:-1 It appears that something is balking whenever targetChar lacks a numerical value, which I deduced by trying <s:set name="targetChar" value="50"/> in headline.tag, which, as expected, worked fine, but neither <s:set name="targetChar" value=""/> <s:set name="targetChar" value="test"/> did; both result in the error pasted above. I'm confused as to where this requirement is coming from; it's an arbitrary custom attribute I'm trying to add in, which doesn't appear to get evaluated at all by Struts (since when I try the data-targetChar="%{#attr.targetChar}" syntax, that literal string ends up as the value). In any event, if anyone has any explanation as to what is going on here, and perhaps a route I might take to achieve my objective, I'd be most appreciative. Happy Holidays to everyone. Thanks, ~~Scott