Bug #7519
closedCancel buttons are validating fields
100%
Description
In the forms, for example registration form, the Cancel button validates the fields. This is most likely present in all of the forms which contain the Cancel button. The expected behaviour is just to go back to the previous page.
Related issues
Updated by Rajmund Hruška about 3 years ago
- Assignee changed from Rajmund Hruška to Jan Mach
Yes, I don't mind.
Updated by Jan Mach about 3 years ago
- Status changed from New to In Progress
- Target version changed from Backlog to 2.9
Updated by Jan Mach about 3 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Fixed, merged, built and deployed to mentat-alt for verification.
The issue was in built-in JS form validation, not in backend form processing code. It was necessary to add onclick handler to all cancel buttons, that will disable the validation prior to submitting the form.
Updated by Jan Mach about 3 years ago
- Status changed from In Review to In Progress
Updated by Jan Mach about 3 years ago
- Status changed from In Progress to In Review
As agreed during our last VC I have removed cancel buttons from all login and registration forms. It does not make any sense here, because the user does not have anywhere to go back, since the whole application is protected by authorization.
Fix deployed to mentat-alt.
Updated by Pavel Kácha almost 3 years ago
- Status changed from In Review to Closed
Updated by Radko Krkoš over 2 years ago
- Status changed from Closed to Feedback
There seems to be some trouble with the fix.
[2022-05-31 17:16:47,229] ERROR in app: Exception on /users/188/update? [GET], referer: https://mentat-hub.cesnet.cz/mentat/users/188/show Traceback (most recent call last):, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show response = self.full_dispatch_request(), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show rv = self.handle_user_exception(e), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show reraise(exc_type, exc_value, tb), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show raise value, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show rv = self.dispatch_request(), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show return self.view_functions[rule.endpoint](**req.view_args), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask_login/utils.py", line 272, in decorated_view, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show return func(*args, **kwargs), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask/views.py", line 89, in view, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show return self.dispatch_request(*args, **kwargs), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/vial/view/__init__.py", line 2196, in dispatch_request, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show return self.generate_response(), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/vial/view/mixin.py", line 94, in generate_response, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show **self.response_context, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask/templating.py", line 140, in render_template, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show ctx.app,, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/flask/templating.py", line 120, in _render, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show rv = template.render(context), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/jinja2/environment.py", line 1291, in render, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show self.environment.handle_exception(), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/jinja2/environment.py", line 925, in handle_exception, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show raise rewrite_traceback_stack(source=source), referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/hawat/blueprints/users/templates/users/creatupdate.html", line 1, in top-level template code, referer: https://menta {%- extends "_layout_creatupdate.html" %}, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/vial/blueprints/design_bs3/templates/_layout_creatupdate.html", line 1, in top-level template code, referer: https:/ {%- extends "_layout.html" %}, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/vial/blueprints/design_bs3/templates/_layout.html", line 197, in top-level template code, referer: https://mentat-hu {%- block body %}, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/vial/blueprints/design_bs3/templates/_layout.html", line 256, in block 'body', referer: https://mentat-hub.cesnet.cz {%- block content %}{% endblock content %}, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/vial/blueprints/design_bs3/templates/_layout_creatupdate.html", line 37, in block 'content', referer: https://mentat {%- block itemform_buttons %}, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/vial/blueprints/design_bs3/templates/_layout_creatupdate.html", line 38, in block 'itemform_buttons', referer: https {{ form.cancel(class_='btn btn-default') }}, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show File "/var/mentat/venv/lib/python3.7/site-packages/jinja2/utils.py", line 84, in from_obj, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show if hasattr(obj, "jinja_pass_arg"):, referer: https://mentat-hub.cesnet.cz/mentat/users/188/show jinja2.exceptions.UndefinedError: 'hawat.blueprints.users.forms.AdminUpdateUserAccountForm object' has no attribute 'cancel', referer: https://mentat-hub.cesnet.cz/menta
Updated by Rajmund Hruška over 2 years ago
This issue is not present at mentat-alt at this moment. I think it was fixed in 72eaea5f and this commit didn't reach release
branch yet.
Updated by Rajmund Hruška 7 months ago
- Precedes Bug #7735: Cancel button are validating fields in filters and event classes added