Hallo together,
I am new to captaincasa and even after searching the board and reading the development guide, I still can't find a solution.
I have seen that the demoworkplace works with radiobuttons using String or boolean, however I want to use an enumeration (enum) for my radiobuttons, e.g. I have two radiobuttons and both link to a variable (enumWert) which has typ "Werte". If the first radiobutton is selected, the variable shall have the first enumvalue (WERTA) and if the second is selected, the enum value shall be WERTB.
Here is some example code:
JSP:
Code:
<t:row id="g_4" >
<t:radiobutton id="g_5" group="AUSWAHL" refvalue="A" text="Wert A" value="#{programm.enumWert}" />
<t:radiobutton id="g_6" group="AUSWAHL" refvalue="B" text="Wert B" value="#{programm.enumWert}" />
</t:row>
Java:
Code:
public enum Werte {
WERTA("A"), // 0
WERTB("B"); // 1
private String bezeichnung;
private Werte(String bezeichnung) {
this.bezeichnung = bezeichnung;
}
public String getBezeichnung() {
return this.bezeichnung;
}
}
In order to realize this, I have tried to modify the refvalue attribute to "A" or "B" or to "Werte.WERTA", however, I always get an IllegalArgumentException.
I know that it is possible to use a boolean if there are only two possible values, however I might have more, thus I really want to use enumerations.
Regards,
Christian