Hello, I am currently working on a code that is responsible for executing various functions within the template. I have utilized scripts to verify these functions using if-else statements and for loops. However, I am encountering some errors during this process. Could anyone provide insight into what might be causing these errors? Thank you in advance.
Upon inspecting the end of the code enclosed within the script tags, the format should resemble the snippet provided below. Regrettably, whenever I attempt to save the code, it becomes unformatted and results in errors.
https://i.stack.imgur.com/src9i.png
https://i.stack.imgur.com/6iFYL.png
{% if messages %}
{% for message in messages %}
alert('{{message}}')
{% endfor %}
{% endif %}
In Upload.html file:
{% extends 'base.html' %} {% block content %}
<div class="form-group">
<label for="name" class="col-md-3 col-sm-3 col-xs-12 control-label">Select : </label>
<div class="col-md-8">
<select name="cars" id="cars">
<option value="">Select</option>
<option value="WithTime">AmpandFreq</option>
<option value="WithoutTime">Amplitude</option>
</select>
</div>
</div>
<div id="withtime" style="display:none">
<form action="/csvapp/upload/" method="POST" enctype="multipart/form-data" class="form-horizontal">
{% csrf_token %}
<div class="form-group">
<label for="name" class="col-md-3 col-sm-3 col-xs-12 control-label">File: </label>
<div class="col-md-8">
<input type="file" name="csv_file" id="csv_file" required="True" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-3 col-sm-3 col-xs-12 col-md-offset-3" style="margin-bottom:10px;">
<button class="btn btn-primary"> <span class="glyphicon glyphicon-upload" style="margin-right:5px;"></span>Upload </button>
</div>
</div>
</form>
</div>
<div id="withouttime" style="display:none">
<form name="form" action="/csvapp/upload_withouttime/" method="POST" enctype="multipart/form-data" class="form-horizontal">
{% csrf_token %}
<div class="form-group">
<label for="name" class="col-md-3 col-sm-3 col-xs-12 control-label">File: </label>
<div class="col-md-8">
<input type="file" name="csv_file" id="csv_file" required="True" class="form-control">
</div>
</div>
<div class="form-group">
<label for="name" class="col-md-3 col-sm-3 col-xs-12 control-label">Sampling Frequency: </label>
<div class="col-md-8">
<input type="text" name="sampfreq" id="sampfreq" required="True" class="form-control">
</div>
</div>
<div class="form-group">
{ %
if a == "WithoutTime" %
} {
alert("inside")
$('#withtime').hide();
$('#withouttime').show();
{ %
else %
} {
$('#withtime').hide();
$('#withouttime').show();
}
})
</script>
{% endblock %}