Workbook 3.2
Individually, each field is valid. But from a cross-field point of view, the user isn't taking the submission process seriously.
Goal: You will use cross-field validation to ensure the user isn't entering garbage data.
Task 1
The following code rejects a field and adds an error to the BindingResult
.
bindingResult.rejectValue(arg1, arg2, arg3): // Argument 1: The field value you wish to reject. // Argument 2: Error Code // Argument 3: Error message.
Using this information:
- reject the
lastName
if it happens to equal thefirstName
. - Leave the error code empty
""
. - Display the error message:
please enter valid data
.
Good Luck!
Feedback Summary
5.0
4 students
5
100%
4
0%
3
0%
2
0%
1
0%
Written Reviews
There are no written reviews yet.