I have a problem getting the value of the selected item in a element.
I am working on Vaadin 10 using a JAVA/HTML TemplateModel and the vaadin-combo-box is a element in the html code.
I can set the values in the combo box from the java side using the SetItems() method.
I can select an item in the drop down list and the valueChange() method fires on the Server side but I cannot seem to get the value of the selected value back on the server side.
I think I am not referencing the correct property.
My html looks like this …
<vaadin-combo-box id="paystates" value="{{userInput}}" label="Payment Status" on-value-changed="valueChange" items="{{paystateitems}}"></vaadin-combo-box>
My Java Code has the following …
public interface PaymentsModel extends TemplateModel {
void setPayments(List<Payment> payments);
String getUserInput();
}
@Id("paystates")
private ComboBox<String> paystates;
List<String> paystateitems = new ArrayList<String>();
.....
paystates.setItems(paystateitems);
@EventHandler
private void valueChange() {
mLogger.info("Value of paystatus from event handler = ", this.getModel().getUserInput());
}
The value from the getUserInput() is always blank.
Grateful for any hint as I have spent a lot of time trying to get this to work and I think I am missing something very basic.