This is what's called when the form is invalid.
511737
def form_invalid(self, form):
        """"""
        ip = get_user_ip(self.request)
        if settings.CONTACT_FORM_USE_SIGNALS:
            contact_form_invalid.send(
                sender=self,
                event=self.invalid_event,
                ip=ip,
                site=self.site,
                sender_name=form['sender_name'],
                sender_email=form['sender_email']
            )

        return super(ContactFormView, self).form_invalid(form)
483082
def form_invalid(self, post_form, attachment_formset, **kwargs):
        
        if (
            attachment_formset and
            not attachment_formset.is_valid() and
            len(attachment_formset.errors)
        ):
            messages.error(self.request, self.attachment_formset_general_error_message)

        return self.render_to_response(
            self.get_context_data(
                post_form=post_form, attachment_formset=attachment_formset, **kwargs
            ),
        )
242363
void invalidate() {
		if (isInvalidationRequired()) {
			view.postInvalidate();
			LOGGER.trace("Called view invalidation");
		}
		if (isInvalidationDelayedRequired()) {
			view.postInvalidateDelayed(getInvalidationDelay());
			LOGGER.trace("Called view delayed invalidation. Delay time is: {}", getInvalidationDelay());
		}
		reset();
	}
1153104
function validateDuplicateName(cb) {
    var formId = formData._id;
    var formName = formData.name;

    if (!formName) {
      return cb(new Error("No form name passed"));
    }

    var query = {};

    //If there is a form id, then the query to the form model must exclude the current form id that is being updated.
    if (formId) {
      query.name = formName;
      //Excluding the formId that is being updated.
      query["_id"] = {"$nin": [formId]};
    } else { //Just checking that the form name exists as a form is being created
      query.name = formName;
    }

    formModel.count(query, function(err, count) {
      if (err) {
        return cb(err);
      }

      //If the number of found forms is > 0, then there is another form with the same name. Do not save the form.
      if (count > 0) {
        return cb(new Error("Form with name " + formName + " already exists found."));
      } else {//No duplicates, can proceed with saving the form.
        return cb();
      }
    });
  }
998039
def form_valid(self, form, forms):
        
        if self.object:
            form.save()
            for (formobj, linkerfield) in forms:
                if form != formobj:
                    formobj.save()
        else:
            self.object = form.save()
            for (formobj, linkerfield) in forms:
                if form != formobj:
                    setattr(formobj.instance, linkerfield, self.object)
                    formobj.save()
        return HttpResponseRedirect(self.get_success_url())
768465
def form_valid(self, form):
        
        response = super().form_valid(form)
        messages.success(self.request, self.success_message)
        return response
1235783
def form_valid(self, form):
        '''
        
        '''
        startDate = form.cleaned_data['startDate']
        endDate = form.cleaned_data['endDate']
        startTime = form.cleaned_data['startTime']
        endTime = form.cleaned_data['endTime']
        instructor = form.cleaned_data['instructorId']

        interval_minutes = getConstant('privateLessons__lessonLengthInterval')

        this_date = startDate
        while this_date <= endDate:
            this_time = startTime
            while this_time < endTime:
                InstructorAvailabilitySlot.objects.create(
                    instructor=instructor,
                    startTime=ensure_localtime(datetime.combine(this_date, this_time)),
                    duration=interval_minutes,
                    location=form.cleaned_data.get('location'),
                    room=form.cleaned_data.get('room'),
                    pricingTier=form.cleaned_data.get('pricingTier'),
                )
                this_time = (ensure_localtime(datetime.combine(this_date, this_time)) + timedelta(minutes=interval_minutes)).time()
            this_date += timedelta(days=1)

        return JsonResponse({'valid': True})
1329546
def forms_valid(self, forms):
        
        for form in six.itervalues(forms):
            form.save()
        return super(MultiModelFormView, self).forms_valid(forms)
71394
public function validate() {
		if( $this->error ) {
			switch( $this->error ) {
				case UPLOAD_ERR_INI_SIZE:
				case UPLOAD_ERR_FORM_SIZE: {
					throw new UserException('fileTooBig');
					break;
				}
				case UPLOAD_ERR_PARTIAL:
				case UPLOAD_ERR_NO_FILE: {
					throw new UserException('transfertIssue');
					break;
				}
				default: {
					// UPLOAD_ERR_NO_TMP_DIR UPLOAD_ERR_CANT_WRITE UPLOAD_ERR_EXTENSION
					// http://php.net/manual/fr/features.file-upload.errors.php
					log_error("Server upload error (error={$this->error}, name={$this->fileName})", 'Uploading file', false);
					throw new UserException('serverIssue');
				}
			}
		}
		
		if( $this->expectedType !== NULL ) {
			if( $this->getType() !== $this->expectedType ) {
				throw new UserException('invalidType');
			}
		}
		if( $this->allowedExtensions !== NULL ) {
			$ext = $this->getExtension();
			if( $ext === $this->allowedExtensions || (is_array($this->allowedExtensions) && !in_array($ext, $this->allowedExtensions)) ) {
				throw new UserException('invalidExtension');
			}
		}
		if( $this->allowedMimeTypes !== NULL) {
			$mt = $this->getMIMEType();
			if( $mt === $this->allowedMimeTypes || (is_array($this->allowedMimeTypes) && !in_array($mt, $this->allowedMimeTypes)) ) {
				throw new UserException('invalidMimeType');	
			}
		}
	}
714026
def form_valid(self, form):
        '''  '''

        startDate = form.cleaned_data.get('startDate')
        repeatEvery = form.cleaned_data.get('repeatEvery')
        periodicity = form.cleaned_data.get('periodicity')
        quantity = form.cleaned_data.get('quantity')
        endDate = form.cleaned_data.get('endDate')

        # Create a list of start dates, based on the passed  values of repeatEvery,
        # periodicity, quantity and endDate.  This list will be iterated through to
        # create the new instances for each event.
        if periodicity == 'D':
            delta = {'days': repeatEvery}
        elif periodicity == 'W':
            delta = {'weeks': repeatEvery}
        elif periodicity == 'M':
            delta = {'months': repeatEvery}

        repeat_list = []
        this_date = startDate

        if quantity:
            for k in range(0, quantity):
                repeat_list.append(this_date)
                this_date = this_date + relativedelta(**delta)
        elif endDate:
            while (this_date <= endDate):
                repeat_list.append(this_date)
                this_date = this_date + relativedelta(**delta)

        # Now, loop through the events in the queryset to create duplicates of them
        for event in self.queryset:

            # For each new occurrence, we determine the new startime by the distance from
            # midnight of the first occurrence date, where the first occurrence date is
            # replaced by the date given in repeat list
            old_min_time = event.localStartTime.replace(hour=0, minute=0, second=0, microsecond=0)

            old_occurrence_data = [
                (x.startTime - old_min_time, x.endTime - old_min_time, x.cancelled)
                for x in event.eventoccurrence_set.all()
            ]

            old_role_data = [(x.role, x.capacity) for x in event.eventrole_set.all()]

            for instance_date in repeat_list:

                # Ensure that time zones are treated properly
                combined_datetime = datetime.combine(instance_date, datetime.min.time())
                new_datetime = ensure_timezone(combined_datetime, old_min_time.tzinfo)

                # Removing the pk and ID allow new instances of the event to
                # be created upon saving with automatically generated ids.
                event.id = None
                event.pk = None
                event.save()

                # Create new occurrences
                for occurrence in old_occurrence_data:
                    EventOccurrence.objects.create(
                        event=event,
                        startTime=new_datetime + occurrence[0],
                        endTime=new_datetime + occurrence[1],
                        cancelled=occurrence[2],
                    )

                # Create new event-specific role data
                for role in old_role_data:
                    EventRole.objects.create(
                        event=event,
                        role=role[0],
                        capacity=role[1],
                    )

                # Need to save twice to ensure that startTime etc. get
                # updated properly.
                event.save()

            return super(RepeatEventsView, self).form_valid(form)
959610
public static FormFillFailure error(String format, Object... args) {
        return error(String.format(format, args));
    }
122592
public function isValid()
    {
        if (!$this->validator) {
            $this->validate();
        }

        $isValid = !$this->validator->fails();

        $this->formHelper->alterValid($this, $this, $isValid);

        $this->eventDispatcher->dispatch(new AfterFormValidation($this, $this->validator, $isValid));

        return $isValid;
    }
705894
protected function validate()
    {
        $this->isValid = true;

        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
            if ($writable instanceof FieldInterface) {
                $writable->validate();
            }
        }

        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
            if (array_key_exists($name, $this->validators) === true) {
                foreach ($this->validators[$name] as $validator) {
                    call_user_func_array($validator, [$writable, $this]);
                }
            }
        }

        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
            if ($writable instanceof FieldInterface && $writable->isValid() === false) {
                $this->isValid = false;
                $this->addError("Please correct the indicated errors and resubmit the form.");
                break;
            }
        }

        foreach ($this->getWritableBearer()->getWritables() as $writable) {
            // Force validation on each subform via isValid()
            // If subform isn't valid and this form is not yet invalid, mark it as invalid
            if ($writable instanceof FormInterface) {
                if ($writable->isValid() === false && $this->isValid === true) {
                    $this->isValid = false;
                    $this->addError("Please correct the indicated errors and resubmit the form.");
                }
            }
        }

        if ($this->errors !== []) {
            $this->isValid = false;
        }
    }
511431
def form_valid(self, form):
        
        # Move the topic
        topic = self.object
        old_forum = topic.forum
        new_forum = form.cleaned_data['forum']
        topic.forum = new_forum

        # Eventually lock the topic
        if form.cleaned_data['lock_topic']:
            topic.status = Topic.TOPIC_LOCKED
        else:
            topic.status = Topic.TOPIC_MOVED

        topic.save()
        old_forum.save()

        messages.success(self.request, self.success_message)
        return HttpResponseRedirect(self.get_success_url())
596890
def form_invalid(self, form, context=None, **kwargs):
        
        if not context:
            context = {}

        context['errors'] = form.errors
        return super(ApiFormView, self).render_to_response(context=context,
                                                           status=400)
23401
public static FormValidation error(String format, Object... args) {
        return error(String.format(format,args));
    }
900540
def form_invalid(self, form):
        """"""
        LOGGER.debug("Invalid Email Form Submitted")
        messages.add_message(self.request, messages.ERROR, _("Invalid Email Address."))
        return super(EmailTermsView, self).form_invalid(form)