Don't allow submit form when fields in blank Django Python -
i know how prevent user of submitting form when of fields left in blank, (i know how validate on server side, i'm looking answer on client side think) thank you!
**
update
** form, combines fields class created (prestamista) , adds 3 fields user class, managed require attribute in last 3 adding widget, don't know how set require argument others prestamista class
class myregistrationform(modelform): class meta: model= prestamista fields = ['trabaja', 'sueldo', 'edad'] fields_required = ['trabaja', 'sueldo', 'edad'] username = forms.charfield(max_length= 30, required=true, widget=forms.textinput(attrs={'required': 'true'})) password = forms.charfield(required=true, widget = forms.passwordinput(attrs={'required': 'true'})) email = forms.emailfield(widget=forms.textinput(attrs={'class': "emailfields",'required': 'true'}))
as patrick.ryan93 pointed out can use required
inputs, instead of rendering forms can add widget form object.
somefield = forms.textfield( required=true, widget=forms.textinput(attrs={'required': 'true'}), )
should render
<input type="text" name=... required>
which won't submitted unless fields have value: jsfiddle
Comments
Post a Comment