Skip to content

Commit

Permalink
CAUSEWAY-3861: fixes action's multiselect param when required but empty,
Browse files Browse the repository at this point in the history
is still accepted (Wicket Viewer Select2)
  • Loading branch information
andi-huber committed Feb 25, 2025
1 parent 852475c commit e051442
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected final boolean hasAnyChoices() {
}

public final boolean checkSelect2Required() {
return select2.isRequired();
return select2.checkRequired();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ record MultiChoice(
private static final long serialVersionUID = 1L;
private boolean workaround;

// -- bug in wicket 8.8.0
// -- bug in wicket-stuff
@Override public void updateModel() {
workaround = true;
super.updateModel();
workaround = false;
}
@Override public Collection<ObjectMemento> getModelObject() {
var modelObj = getModelObject();
var modelObj = super.getModelObject();
if(workaround) {
return modelObj==null
? null
Expand All @@ -63,6 +63,8 @@ record MultiChoice(
// --

});

component().setRequired(attributeModel.isRequired());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ default void clearInput() {
component().clearInput();
}

default boolean isRequired() {
return component().isRequired();
default boolean checkRequired() {
return component().checkRequired();
}

default void setMutable(final boolean mutability) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ record SingleChoice(Select2Choice<ObjectMemento> component)
final UiAttributeWkt attributeModel,
final ChoiceProvider choiceProvider) {
this(new Select2Choice<>(id, model, choiceProvider.toSelect2ChoiceProvider()));
component().setRequired(attributeModel.isRequired());
}

@Override
Expand Down

0 comments on commit e051442

Please sign in to comment.