I am using django 1.7.
When a user enters single and/or double quotation marks as part of their input, the form displaying their entered data is broken.
So I used django's escape tag, which should deal with this very easily.
However, the escape tag is only escaping the double quotation marks. The single quotation marks are not being escaped and are breaking the test form.
Here is an example of my code:
{{ field|escape }}
Does anyone know how to overcome this issue.
EDIT
Here is my form field template code (form_fields.html):
<div id="row_{{ field.auto_id }}" class="form-group {% if field.errors %}error{% endif %} {% if hide_row %}hidden{% endif %}">
<label for="{{ field.auto_id }}" class="control-label {{ field.css_classes }}">
{{ field.label }}{% if field.label %}:{% endif %}
</label>
<div class="controls {{ control_classes }}">
{{ field|escape }}
{% if field.errors %}
<span class="help-inline">
<strong>
{% for e in field.errors %}
{{ e }}<br/>
{% endfor %}
</strong>
</span>
{% endif %}
{% if field.help_text %}
<p class="help-block">
{{ field.help_text }}
</p>
{% endif %}
</div>
</div>
And here is the form template field code:
{% load form_fields %}
....
{% form_field form.name_details_prefix_title %}
I ultimately tracked th error to a js issue.
I used the following tag to solve the issue:
{{ field|escapejs }}
Hope that this helps some one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With