This content has been marked as final.
Show 2 replies
-
1. Re: how to show h:selectmanycheckbox items checked
kragoth Jan 30, 2011 8:23 PM (in response to pouria62)Just make sure whatever value they are binding back to has the value true.
Instead of asking how to do something. Think about your problem and try to write something. Then when you get stuck post what you have and ask why it doesn't work.
-
2. Re: how to show h:selectmanycheckbox items checked
pouria62 Jan 31, 2011 12:27 AM (in response to pouria62)here is my java code which i wish it check my checkbox but it didnt.
private long positionTypeId;
public long getPositionTypeId() {
if (this.positionType != null)
return this.getPositionType().getId();
else
return 0;
}
public void setPositionTypeId(long value) {
this.positionTypeId = value;
this.positionType = this.entityManager.find(PositionType.class,
this.positionTypeId);
this.selectedOptions.clear();
for (PositionTypeSeverity sev : this.positionType.getPositionTypeSeverity()) {
Long sev_id = sev.getId();
this.selectedOptions.add(sev_id);
}
}
<h:form id="positionTypeSeverityAdd" styleClass="edit">
<rich:panel>
<h:panelGrid>
<h:outputText value="#{positionTypeSeverityConversation.positionType.name}" />
<h:selectManyCheckbox id="severity" value="#{positionTypeSeverityConversation.selectedOptions}">
<s:selectItems var="_ser" value="#{positionTypeSeverityConversation.severities}"
label="#{_ser.name}" itemValue="#{_ser.id}" />
</h:selectManyCheckbox>
</h:panelGrid>
</rich:panel>
<h:commandButton id="save" value="Save"
action="#{positionTypeSeverityConversation.save()}"
style="FONT-FAMILY: 'Abyssinica SIL';">
</h:commandButton>
<s:button view="/setting/hr/PositionType.xhtml" id="cancelAdd"
value="Cancel">
<f:param name="positionTypeId" value="#{positionTypeId}" />
</s:button>
</h:form>