如何根据同一页上另一个表单的字段有条件地要求填写整个表单?
forms.py:
from django import forms
class OptionForm(forms.Form):
"""Whether or not the user wants to fill the contact form"""
fill_form = forms.BooleanField(initial=True)
class ContactForm(forms.Form):
name = forms.CharField()
e
我希望仅当选中另一个复选框时才启用(默认情况下)禁用复选框。这允许我选中新启用的复选框。捕获是在表单提交时,如果选中了另一个复选框,则应保持启用状态。
<input type="checkbox" class="checkbox1" id="checkbox1" name="vehicle" value="Bike">I am enabled and must be clicked<br>
<input type="checkbox" class="checkb