I have a form where I am overriding the init so I can set some checkboxes to be disabled, these disabled checkboxes are pre-checked.
class HomePhoneBundleOrderForm(forms.Form):
def __init__(self, *args, **kwargs):
super(HomePhoneBundleOrderForm, self).__init__(*args, **kwargs)
self.fields['telephone_line'].widget.attrs['disabled'] = 'disabled'
self.fields['voice_mail'].widget.attrs['disabled'] = 'disabled'
telephone_line = forms.BooleanField(initial=True, help_text="Local telephone line included.")
voice_mail = forms.BooleanField(label="", help_text="Voicemail – included in this bundle.", initial=True)
The problem is when I submit this form, even when they are pre-checked, the form gives me an error saying that the field is required and then the checkbox becomes unchecked. Can you anyone give me some help as to why and how to fix this?
Thanks
-J