Hi all,
I hope that someone can help me..
Here is a bit of code from my xhmtl page:
<tr:subform id="meansTransport">
<h:panelGrid columns="5">
<!-- Means of transport of
the goods -->
<kpm:label msgName=
"letter.of.credit.label.means.of.transport"
dubbelpunt="true"
/>
<tr:spacer width="2px" />
<tr:selectOneChoice
value
="#{locDataPaginaServiceBean.letterOfCredit.locMeansTransport}"
onchange=
"kpmClickLink('meansTransport:meansTransportLink')"
required="true">
<c:forEach var=
"item"
items
="#{locDataPaginaServiceBean.allMeansTransport}">
<
tr:selectItem value="#{item}"
label="#{msg[item.meansTransportInfo]}" />
</c:forEach>
</tr:selectOneChoice>
<tr:spacer width="2px" />
<tr:inputText columns="25"
maximumLength="22"
value
="#{locDataPaginaServiceBean.letterOfCredit.locMeansTransportFreeText}"
disabled
="#{locDataPaginaServiceBean.letterOfCredit.locMeansTransport !=
'MEANS_TRANSPORT_SPECIFY'}"
required
="#{locDataPaginaServiceBean.letterOfCredit.locMeansTransport ==
'MEANS_TRANSPORT_SPECIFY'}" />
<tr:commandLink id=
"meansTransportLink"
inlineStyle=
"display:none; visibility: hidden;"
partialSubmit=
"true" />
</h:panelGrid>
</tr:subform>
What I am trying to achieve is to set the disabled and required properties
based on an enum (locMeansTransport). Whenever the value in the
tr:selectOneChoice changes, I trigger the command link so that the value
of the tr:selectOneChoice is put in the data model.
Once that is done I want to enable the input text based on the value of
the item in the tr:selectOneChoice. I can't get this to work. I have also
tried using a method in my backing bean that returns a Boolean, but that
doesn't work either...does anyone have an idea?
BTW this is the enum...
public enum MeansTransport {
MEANS_TRANSPORT_SPECIFY(1,
"letter.of.credit.label.specify"),
MEANS_TRANSPORT_VESSEL(2,
"letter.of.credit.label.means.transport.vessel"),
MEANS_TRANSPORT_PLANE(3,
"letter.of.credit.label.means.transport.plane"),
MEANS_TRANSPORT_TRUCK(4,
"letter.of.credit.label.means.transport.truck"),
MEANS_TRANSPORT_TRAIN(5,
"letter.of.credit.label.means.transport.train");
private int meansTransportNumber;
private String meansTransportInfo;
private MeansTransport(int meansTransportNumber, String
meansTransportInfo) {
this.meansTransportNumber = meansTransportNumber;
this.meansTransportInfo = meansTransportInfo;
}
public int getMeansTransportNumber() {
return meansTransportNumber;
}
public String getMeansTransportInfo() {
return meansTransportInfo;
}
}
Regards,,
Willem Kunkels
Java Developer
Koopman International BV
Distelweg 88
1031 HH Amsterdam
The Netherlands
Tel.: +31 20 494 7 893
www.koopmanint.com