You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matt Raible <li...@raibledesigns.com> on 2004/12/02 22:35:01 UTC
selectManyCheckbox -> hidden fields for some users
I have a requirement to show a group of checkboxes for some users, and
hide them for others. When they're hidden, I still want to retain the
data - so storing them as hidden fields seems the logical thing to do.
I have this for the users that can edit the checkboxes:
<h:selectManyCheckbox value="#{userForm.userRoles}" id="userRoles">
<f:selectItems value="#{userForm.availableRoles}"/>
</h:selectManyCheckbox>
This works great. For hidden fields, I'm using:
<f:verbatim>
<c:forEach var="role" items="${userForm.userRoles}"
varStatus="status">
<c:out value="${role}"/><c:if
test="${!status.last}">,</c:if>
<input type="hidden" name="userForm:userRoles"
value="<c:out value="${role}"/>" />
</c:forEach>
</f:verbatim>
While this works, I'd rather not have to wrap it with <f:verbatim> (for
my <h:panelGrid) - is there an easier way to do this?
Thanks,
Matt