django forms - remove "submit" button
I have a simple form that enables selecting an option (radio button). Upon selection the form automatically submits itself (using the onchange
attribute):
class MyForm(forms.Form):
choices=forms.ChoiceField( widget=forms.RadioSelect(attrs={'onchange': 'this.form.submit();'}), choices=[(k,k) for k in options],label="choose one")
This is great, only problem is I still have the "submit" but开发者_运维知识库ton at the bottom of the form when it's rendered. Is it possible, without creating a template, to somehow make the form render without a submit button?
From Django doc:
The form only outputs its own fields; it is up to you to provide the surrounding tags and the submit button.
It means that you probably have the submit button in you template - remove it if you don't need it.
精彩评论