Skip to content

Commit

Permalink
Merge pull request #644 from AkshataKatwal16/reassign-cohorts
Browse files Browse the repository at this point in the history
Issue feat: Add username validation error message
  • Loading branch information
itsvick authored Jan 24, 2025
2 parents 9a85619 + e7d1e07 commit 62758e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -610,12 +610,15 @@
"MIN_LENGTH_CHARACTERS_ERROR": "Minimum {{minLength}} characters required",
"MAX_LENGTH_CHARACTERS_ERROR": "Maximum {{maxLength}} characters allowed",
"NUMBER_AND_SPECIAL_CHARACTERS_NOT_ALLOWED": "Numbers and special characters are not allowed",

"ENTER_VALID_MOBILE_NUMBER": "Enter Valid mobile number",
"ENTER_VALID_EMAIL": "Enter valid Email",
"ENTER_VALID_YEAR": "Enter valid Year",
"MUST_BE_LESS_THAN": "{{fieldname}} must be less than {{maxLength}}",
"MUST_BE_GREATER_THAN": "{{fieldname}} must be greater than {{minLength}}",
"ENTER_VALID_CENTER_NAME": "Enter valid center name"
"ENTER_VALID_CENTER_NAME": "Enter valid center name",
"SPACE_AND_SPECIAL_CHARACTERS_NOT_ALLOWED": "Space and special characters are not allowed"

},
"COURSE_PLANNER": {
"COURSE_PLANNER": "Curriculum Plan",
Expand Down
10 changes: 10 additions & 0 deletions src/components/DynamicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ const DynamicForm: React.FC<DynamicFormProps> = ({
);
break;
}
case '^[a-zA-Z0-9.@]+$':

{
error.message = t(
'FORM_ERROR_MESSAGES.SPACE_AND_SPECIAL_CHARACTERS_NOT_ALLOWED'
);
break;


}
default: {
if (error?.property === '.email') {
const validEmail = emailPattern.test(pattern);
Expand Down

0 comments on commit 62758e5

Please sign in to comment.