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

Bug: не работает валидация поля ввода email #260

Open
bazilval opened this issue May 2, 2024 · 3 comments
Open
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@bazilval
Copy link
Collaborator

bazilval commented May 2, 2024

Summary

При вводе email, который длиннее разрешенного, у нас появляется окно ошибки.
image
image

Reproduction steps

1. Открыть workspace
2. Ввести длинный email

Expected result

Поле становится красным, под полем появляется текст ошибки

Actual result

Появляется стандартная страница с ошибкой

Browsers

No response

OS

No response

@bazilval bazilval added the bug Something isn't working label May 2, 2024
@bazilval
Copy link
Collaborator Author

bazilval commented May 2, 2024

Вроде как ошибка из-за того, что делается return, а не redirect

        if (bindingResult.hasErrors()) {
            return "workspace/wks-users";
        }

Однако если просто изменить одно на другое, то самой валидации для пользователя не происходит, так как не появляются строки с ошибками, хотя в разметке всё вроде как надо

<form method="POST" th:action="@{'/workspace/' + ${wksId} + '/users'}" th:object="${inputEmail}">
                    <div class="form-group">
                        <input type="email" class="form-control" id="inputUserEmail" placeholder="Enter user email. For example: hexlet@gmail.com" th:field="*{email}"
                               th:classappend="${!#fields.hasErrors('email') && formModified}? 'is-valid'"
                               th:errorclass="is-invalid" required>
                        <label for="inputUserEmail" th:text="#{email}"></label>
                        <div class="alert alert-danger" th:if="${#fields.hasErrors('email')}">
                            <p th:each="err : ${#fields.errors('email')}" th:text="${err}"></p>
                        </div>
                        <small id="emailHelp" class="form-text text-muted"></small>
                    </div>
                    <button type="submit" class="btn btn-secondary" th:text="#{btn.add-to-wks}"></button>
                </form>

@bazilval
Copy link
Collaborator Author

bazilval commented May 2, 2024

Точно такая же ситуация и с формой создания Workspace

d1z3d added a commit to d1z3d/hexlet-correction that referenced this issue Jun 2, 2024
d1z3d added a commit to d1z3d/hexlet-correction that referenced this issue Jun 2, 2024
@d1z3d
Copy link
Contributor

d1z3d commented Jun 2, 2024

@bazilval, Добрый день!
Создал и отправил пр на проверку

@fey fey added the good first issue Good for newcomers label Jun 4, 2024
d1z3d added a commit to d1z3d/hexlet-correction that referenced this issue Jun 9, 2024
d1z3d added a commit to d1z3d/hexlet-correction that referenced this issue Jun 9, 2024
d1z3d added a commit to d1z3d/hexlet-correction that referenced this issue Jun 11, 2024
fey added a commit that referenced this issue Jun 13, 2024
d1z3d added a commit to d1z3d/hexlet-correction that referenced this issue Jun 15, 2024
d1z3d added a commit to d1z3d/hexlet-correction that referenced this issue Jun 16, 2024
d1z3d added a commit to d1z3d/hexlet-correction that referenced this issue Jun 23, 2024
d1z3d added a commit to d1z3d/hexlet-correction that referenced this issue Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants