Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue_#1933/Adding name validation #1937

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ const UserSettingsForm = ({ onSubmit, settings }) => {
(name = '') => (
settings.name === name || name.length <= 16
),
).matches(
/^[a-zA-Z]+[a-zA-Z0-9_-\s{1}][a-zA-Z0-9_]+$/i,
'Should contain Latin letters, numbers and underscores. Only begin with latin letter',
Comment on lines +82 to +84
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Только для уже текущих имен, нужно поставить проверку, что оно было изменено. Иначе на этой проверке, любая другая настройка может не пройти.

Тоесть если я не меняю имя, то форма должна сабмитить дальше.

Copy link
Author

@Kaiseridze Kaiseridze Jul 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Только для уже текущих имен, нужно поставить проверку, что оно было изменено. Иначе на этой проверке, любая другая настройка может не пройти.

Тоесть если я не меняю имя, то форма должна сабмитить дальше.

Извините, но я не понял в чем заключается суть дополнения. Сейчас приведу скрины
image
image
image
В случае, когда форма валидна, есть возможность сохранить измененные данные, при отсутствии изменений, или невалидности строки - поведение кнопки меняется на disabled

)
.trim(),
clan: Yup.string()
Expand Down