Erweiterungen
This commit is contained in:
@@ -1273,16 +1273,6 @@ public class AddJobView extends Main {
|
||||
qty.setMax(9999); // Set reasonable maximum
|
||||
qty.setWidth("10%");
|
||||
qty.setRequiredIndicatorVisible(true);
|
||||
// Add validation on blur
|
||||
qty.addBlurListener(e -> {
|
||||
if (qty.getValue() == null || qty.getValue() <= 0) {
|
||||
qty.setInvalid(true);
|
||||
qty.setErrorMessage("Anzahl muss größer als 0 sein");
|
||||
} else {
|
||||
qty.setInvalid(false);
|
||||
qty.setErrorMessage("");
|
||||
}
|
||||
});
|
||||
|
||||
NumberField weight = new NumberField("Gewicht");
|
||||
weight.setSuffixComponent(new Span("kg"));
|
||||
@@ -1343,9 +1333,13 @@ public class AddJobView extends Main {
|
||||
boolean isInvalid = intField.getValue() == null || intField.getValue() <= 0;
|
||||
intField.setInvalid(isInvalid);
|
||||
if (isInvalid) {
|
||||
intField.setErrorMessage("Anzahl muss größer als 0 sein");
|
||||
intField.setErrorMessage("");
|
||||
intField.getStyle().set("--vaadin-input-field-background", "rgba(255, 0, 0, 0.1)");
|
||||
intField.getStyle().set("--vaadin-input-field-border-color", "rgba(255, 0, 0, 0.3)");
|
||||
} else {
|
||||
intField.setErrorMessage("");
|
||||
intField.getStyle().remove("--vaadin-input-field-background");
|
||||
intField.getStyle().remove("--vaadin-input-field-border-color");
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1389,6 +1383,7 @@ public class AddJobView extends Main {
|
||||
|
||||
// Initial validation
|
||||
validateField.accept(desc);
|
||||
validateField.accept(qty);
|
||||
validateField.accept(weight);
|
||||
validateField.accept(len);
|
||||
validateField.accept(wid);
|
||||
|
||||
Reference in New Issue
Block a user