【发布时间】:2021-04-22 02:46:14
【问题描述】:
django form with ChoiceField (1,2,3)--> {{Choices.sollicitanten}} 带有 ChoiceField (1,2,3) 的 django 表单 -->{{ form.vacature_contract }} 两个字段的选择选项都是一样的 1,2,3 我想要的是,例如,当我选择choices.sollicitanten 中的选择1 时,它会将此选择复制到字段{{form.vacature_contract}},以便选择该字段也是1。
<td class="tg-0lax">{{ Choices.sollicitanten}}</td>.
//我有
<td name="vacature_doel" class="tg-0lax">{{ form.vacature_contract }}</td>
//在html中
function FillForm(f) {
{
f.vacature_doel.value = f.vacature_bron.value;
f.sollicitanten_doel.value = f.sollicitanten_bron.value;
}
}
</script>
//当我点击提交按钮时,函数运行(onclick=FillForm)。
//上面的代码好像没做太多..出了什么问题。
【问题讨论】:
标签: javascript html django django-templates