cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brent Johnson <bljohn...@gmail.com>
Subject Modifying Attributes in JXTemplate
Date Wed, 13 Apr 2005 13:27:21 GMT
I dont know about anyone else, but I find myself having to do a lot of
<jx:choose> entries just for doing things like using a "checked"
attribute on an <option>.  This has become quite annoying.  Here's an
example:

<jx:forEach items="${types}" var="${type}">
    <jx:choose>
        <jx:when test="${type.isChecked()}">
            <input type="checkbox" name="type" value="${type.getId()}"
checked="1"/>
        </jx:when>
        <jx:otherwise>
            <input type="checkbox" name="type" value="${type.getId()}"/>
        </jx:otherwise>
    </jx:choose>
    ${type.getName()}
</jx:forEach>

Since the "checked" attribute shows a check mark no matter what value
is in the checked attribute, the whole tag has to be specified twice
in a <jx:choose>, the only difference being the checked attribute. 
This is also the same for <options> tag and the selected attribute.

Is there a better way to do this?  There any plans, or is there a
possibility for future enhancement to add something like:

<input type="checkbox" name="type" value="${type.getId()}">
  <jx:attribute name="checked">${checkval}</jx:attribute>
</input>

Thanks,

- Brent

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message