我在烧瓶里有这样的表格:
class form1(Form):
count1=IntegerRangeField('count1')
count2=IntegerRangeField('count2')
class form2(Form):
Incoming=FormField(form1)
Outgoing=FormField(form1)
在模板中,我使用循环渲染字段,循环根据字段类型运行宏:
{% macro render(form) %}
<script type='text/javascript'>
function updateRangeInput(elem) {
$(elem).next().val($(elem).val());
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body>
{% if field.type in ["IntegerRangeField","FormField"] %}
{{field.name}}
{{field(min=0, max=25, oninput="updateRangeInput(this)")}}
<output><script> document.write() </script > </output>
{% else %}
</body>
{% endmacro %}
该宏不显示为IntegralErrangeFields(宏)选择的滑块整数,但字段会在页面上呈现。如何让FormFields下面的IntegralErrangeFields应用宏?
注意:如果我直接在FormField表单中使用IntegralErrangeFields,它就可以工作了。