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

error messages should be handled by javascript #424

Open
btbonval opened this issue Mar 12, 2015 · 0 comments
Open

error messages should be handled by javascript #424

btbonval opened this issue Mar 12, 2015 · 0 comments

Comments

@btbonval
Copy link
Member

Right now, messages are created in Python and served only on page refresh/reload by injection into a template:

{% if messages %}
{% for message in messages %}
<div class="row">
<div class="small-12 columns message-container">
<div data-alert class="alert-box radius {{ message.tags }}
{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}warning{% endif %}
{% if message.level == DEFAULT_MESSAGE_LEVELS.DEBUG %}info{% endif %}">
{{ message }}
</div>
</div>
</div>
{% endfor %}
{% endif %}

This means AJAX errors cannot be displayed the same way, as they do not interact with Python messages nor do they trigger a page refresh.

A very simple solution is to create a message container div which is empty by default. Create a javascript function to inject messages into the message container. In the template, loop through the messages and call the javascript function instead of injecting directly into the form.

For the time being, I guess I'll just make a javascript alert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant