Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

form field required in django views

if request.method == 'POST':
      form = LabelingForm(request.POST)

      required = 'C' in request.POST
      form.fields['First_choice'].required = required
      form.fields['Second_choice'].required = required

      if form.is_valid():
          ...
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #form #field #required #django #views
ADD COMMENT
Topic
Name
4+2 =