dear stackoverflow!
Professionals, please help.
i need to implement a form like this in Django:
If a user enters something in the “another amount” field, the radio buttons become disabled.
I really have no idea.
my html:
<div class="payment__amount">
<div class="payment__amount__1">
<div class="form-check payment__amount__check">
{{ form.amount_select.0 }}
</div>
<div class="form-check payment__amount__check">
{{ form.amount_select.1 }}
</div>
</div>
<div class="payment__amount__2">
<div class="form-check payment__amount__check">
{{ form.amount_select.2 }}
</div>
<div class="form-check payment__amount__check">
{{ form.amount_select.3 }}
</div>
</div>
</div>
{{ form.amount_input }}
my forms.py
CHOISES = [
('50', '50'),
('100', '100'),
('200', '200'),
('500', '500')
]
class CheckoutForm(forms.Form):
amount_select = forms.IntegerField(widget=forms.RadioSelect(choices=CHOISES))
amount_input = forms.IntegerField(widget=forms.TextInput(attrs={'placeholder': "another amount"}))
Thank you very much!