Skip to content

Commit

Permalink
fix: 🐛 Default error msg for required single checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
dBucik committed Jun 13, 2023
1 parent 2882653 commit ebb913f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ public interface PerunRegistrarTranslation extends PerunTranslation {
@DefaultMessage("You must select at least one option!")
public String cantBeEmptyCheckBox();

@DefaultMessage("You must check this box!")
public String cantBeEmptySingleCheckBox();

@DefaultMessage("Incorrect email address format!")
public String incorrectEmail();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ public boolean validateLocal(Checkbox checkbox) {
} else {
// single checkbox - prefer own error message
setResult(Result.EMPTY);
checkbox.setRawStatus(getErrorMsgOrDefault(checkbox), ValidationState.ERROR);
String msg = getErrorMsgOrDefault(checkbox);
if (msg.equals(getTransl().incorrectFormat())) {
msg = getTransl().cantBeEmptySingleCheckBox();
}
checkbox.setRawStatus(msg, ValidationState.ERROR);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ duplicateKeys=Každý klíč musí být unikátní!
cantBeEmpty=Položka <b>nesmí být prázdná!</b>
cantBeEmptySelect=Musíte vybrat jednu z možností!
cantBeEmptyCheckBox=Musíte vybrat alespoň jednu možnost!
cantBeEmptySingleCheckBox=Tuhle položku musíte označit!
incorrectEmail=Neplatný formát e-mailové adresy!
checkAndSubmit=Zkontrolovat a odeslat formulář
passEmpty=Heslo <b>nesmí být prázdné!</b>
Expand Down

0 comments on commit ebb913f

Please sign in to comment.