Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Fixes #228 Highlighted errors #258

Closed
Closed
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
57 changes: 34 additions & 23 deletions malaria_web/templates/malaria/create_post.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,45 @@ <h2 class="text-center inverted-font">New Post</h2>
{% csrf_token %}
<div class="form-group">
<label class="col-sm-2 control-label inverted-font">Title <span class="ast" >*</span></label>
<div class="col-sm-9">
<input class="form-control" type="text" name="title_post" value="{% if form.title_post.value %}{{ form.title_post.value }}{% endif %}">
<p class="help-block inverted-font">
<strong>
{% if form.title_post.errors %}
{% for error in form.title_post.errors %}
{{ error }}
{% endfor %}
{% endif %}
</strong>
</p>

{% if form.title_post.errors %}
<div class="col-sm-9 has-error">
<input class="form-control" type="text" name="title_post" value="{% if form.title_post.value %}{{ form.title_post.value }}{% endif %}">
<p class="help-block inverted-font">
<strong>
{% for error in form.title_post.errors %}
{{ error }}
{% endfor %}
</strong>
</p>
</div>
{% else%}
<div class="col-sm-9">
<input class="form-control" type="text" name="title_post" value="{% if form.title_post.value %}{{ form.title_post.value }}{% endif %}">
</div>
{% endif %}


</div>
<div class="form-group">
<label class="col-sm-2 control-label inverted-font">Description <span class="ast" >*</span></label>
<div class="col-sm-9">
<textarea class="form-control" rows="18" name="description_post" minlength=100>{% if form.description_post.value %}{{ form.description_post.value }}{% endif %}</textarea>
<p class="help-block inverted-font">
<strong>
{% if form.description_post.errors %}
{% for error in form.description_post.errors %}
{{ error }}
{% endfor %}
{% endif %}
</strong>
</p>
{% if form.description_post.errors %}
<div class="col-sm-9 has-error">
<textarea class="form-control" rows="18" name="description_post" minlength=100>{% if form.description_post.value %}{{ form.description_post.value }}{% endif %}</textarea>
<p class="help-block inverted-font">
<strong>
{% for error in form.description_post.errors %}
{{ error }}
{% endfor %}
</strong>
</p>
</div>
{% else %}
<div class="col-sm-9">
<textarea class="form-control" rows="18" name="description_post">{% if form.description_post.value %}{{ form.description_post.value }}{% endif %}</textarea>
</div>
{% endif %}
</div>
</div>
<div class="form-group">
<div class="col-sm-12 col-sm-offset-2">
<button type="submit" class="btn btn-default">Submit</button>
Expand Down