因此,我试图在{{form.mprodname(class =“ form-control form-control-lg”)}}中获取用户的值,以便在if语句中使用它进行比较。我如何在提交之前获得该价值?
<!-- Modal code-->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style="margin- top:150px;">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="exampleModalLabel">Move Product</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="" method="post">
{{ form.csrf_token() }}
<div id="prod">
{{form.mprodname.label(class="form-control-label")}}<br>
render_field(form.mprodname(class="form-control form-control-lg"))
</div>
<div id="from">
{{form.src.label(class="form-control-label")}}<br>
{{form.src(class="form-control form-control-lg")}}
</div>
<div id="to">
{{form.destination.label(class="form-control-label")}}<br>
{{form.destination(class="form-control form-control-lg")}}
</div>
<div class="qty">
{{form.mprodqty.label(class="form-control-label")}}<br>
{% for p in pdetails %}
``` {%if p.prod_name == '?' %}
<div>
{{form.mprodqty(class="form-control form-control-lg",placeholder=p.prod_qty) }}
</div>
{% endif %}
```
{%endfor%}
</div>
</div>
我希望占位符具有产品的当前数量