So the
{{ form.do }}
field from the following form:SUBMIT_CHOICES = (
('save', _("Save")),
('save-add', _("Save and Add Another")),
)
class TestForm(forms.Form):
do = forms.ChoiceField(
widget=MultipleSubmitButton,
choices=SUBMIT_CHOICES,
)
will be rendered as:
<ul>
<li><button type="submit" name="do" value="save">Save</button></li>
<li><button type="submit" name="do" value="save-add">Save and Add Another</button></li>
</ul>
Can somebody enhance this widget so that it supports iteration through different choices and getting specific buttons by indexes in the template? My trials failed, but maybe you will succeed!
Arrrgh! ****ing IE submits the inner HTML of the button instead of its value. Any ideas?
ReplyDeleteUff.. Fixed the case of IE by overriding the value_from_dict method.
ReplyDelete