Skip to content

Commit fcd512d

Browse files
committed
1532 Do not allow words that are digits
1 parent e744533 commit fcd512d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/ai/elimu/web/content/word/WordCreateController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public String handleSubmit(
113113
Model model) {
114114
logger.info("handleSubmit");
115115

116-
validWord(word, result);
116+
validateWord(word, result);
117117

118118
if (result.hasErrors()) {
119119
model.addAttribute("word", word);
@@ -266,7 +266,7 @@ private void autoSelectLetterSoundCorrespondences(Word word) {
266266
word.setLetterSoundCorrespondences(letterSoundCorrespondences);
267267
}
268268

269-
private void validWord(Word word, BindingResult result) {
269+
private void validateWord(Word word, BindingResult result) {
270270
Word existingWord = wordDao.readByText(word.getText());
271271

272272
if (existingWord != null) {
@@ -278,7 +278,7 @@ private void validWord(Word word, BindingResult result) {
278278
}
279279

280280
if (word.getText().matches(".*[0-9].*")) {
281-
result.rejectValue("text", "WordContainsNumber");
281+
result.rejectValue("text", "WordNumbers");
282282
}
283283
}
284284
}

src/main/webapp/WEB-INF/i18n/errors_en.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ formatHint.Integer=Number (e.g. "5000")
3232
image.too.small=The image width must be at least 640px
3333
emoji.unicode.version=Only emojis up to Unicode version 9
3434
WordSpace=Spaces are not allowed
35-
WordContainsNumber=Word contain number
35+
WordNumbers=A word cannot consist of numbers

0 commit comments

Comments
 (0)