3104 PO 3,4) Add client side validation to the publishing constent choice

This commit is contained in:
Andreas Svanberg 2023-10-04 23:34:46 +02:00
parent f67eca8e87
commit 9f10421b76

@ -7,6 +7,7 @@ import org.apache.wicket.util.value.AttributeMap;
import org.apache.wicket.util.value.IValueMap;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
public class BootstrapRadioChoice<T> extends RadioChoice<T> {
@ -41,6 +42,11 @@ public class BootstrapRadioChoice<T> extends RadioChoice<T> {
@Override
protected IValueMap getAdditionalAttributes(final int index, final T choice) {
return new AttributeMap(Collections.singletonMap("class", "form-check-input"));
HashMap<String, Object> attributes = new HashMap<>();
attributes.put("class", "form-check-input");
if (isRequired()) {
attributes.put("required", "required");
}
return new AttributeMap(attributes);
}
}