If form valid return response with action
761703
def form_valid(self, form):
        
        response = super(FormAjaxMixin, self).form_valid(form)
        if self.request.is_ajax():
            return self.json_to_response()
        return response
286326
def response_indicates_valid?(response)
      REXML::Document.new(response.body).root.get_elements('//m:validity').first.text == 'true'
    end
932119
function (form) {
            var viewData = {
              form: form,
              organization: req.organization
            };
            // The form library puts us in this error case if the form is empty,
            // which is true when you arrive on the form with a GET request.
            // This conditional allows us to control what we do in that situation
            if (form.data && !form.data.email) {
              client.getCurrentTenant(function (err, tenant) {
                if (err) {
                  logger.info(err.message);
                  viewData.error = err.userMessage;
                  return helpers.render(req, res, view, viewData);
                }

                tenant.verifyAccountEmail(req.query.sptoken, function (err, account) {
                  if (err) {
                    logger.info(err.message);
                    viewData.invalid_sp_token = true;
                    return helpers.render(req, res, view, viewData);
                  }

                  client.getAccount(account.href, function (err) {
                    if (err) {
                      logger.info(err.message);
                      viewData.error = err.userMessage;
                      return helpers.render(req, res, view, viewData);
                    }

                    res.redirect(config.web.login.uri + '?status=verified');
                  });
                });
              });
            } else {
              viewData.formErrors = helpers.collectFormErrors(form);
              helpers.render(req, res, view, viewData);
            }
          }
967334
def form_valid(self, form):
        """"""

        ret = super(ProjectCopy, self).form_valid(form)
        self.copy_relations()

        # Good to make note of that
        messages.add_message(self.request, messages.SUCCESS, 'Project %s copied' % self.object.name)

        return ret
213386
def is_valid(self):
        """"""
        form = super(AuthenticateForm, self).is_valid()
        for f, error in self.errors.items():
            if f != "__all__":
                self.fields[f].widget.attrs.update({"class": "error", "placeholder": ", ".join(list(error))})
            else:
                errors = list(error)
                if "This account is inactive." in errors:
                    message = "Intranet access restricted"
                else:
                    message = "Invalid password"
                self.fields["password"].widget.attrs.update({"class": "error", "placeholder": message})

        return form
1023717
def form_valid(self, form):
        
        #noinspection PyAttributeOutsideInit
        self.object = form.save()
        meta        = getattr(self.object, '_meta')

        # Index the object.
        for backend in get_search_backends():
            backend.add(object)

        #noinspection PyUnresolvedReferences
        messages.success(
            self.request,
            _(u'{0} "{1}" saved.').format(
                meta.verbose_name,
                str(self.object)
            ),
            buttons=[messages.button(
                reverse(
                    '{0}:edit'.format(self.url_namespace),
                    args=(self.object.id,)
                ),
                _(u'Edit')
            )]
        )

        return redirect(self.get_success_url())
790044
def form_valid(self, form):
        """"""
        instance = form.save(commit=False)
        if hasattr(self.request, 'user'):
            instance.user = self.request.user
        if settings.CONTACT_FORM_FILTER_MESSAGE:
            instance.message = bleach.clean(
                instance.message,
                tags=settings.CONTACT_FORM_ALLOWED_MESSAGE_TAGS,
                strip=settings.CONTACT_FORM_STRIP_MESSAGE
            )
        instance.ip = get_user_ip(self.request)
        instance.site = self.site
        instance.save()
        if settings.CONTACT_FORM_USE_SIGNALS:
            contact_form_valid.send(
                sender=self,
                event=self.valid_event,
                ip=instance.ip,
                site=self.site,
                sender_name=instance.sender_name,
                sender_email=instance.sender_email,
                email=instance.subject.department.email,
                subject=instance.subject.title,
                message=instance.message
            )

        return super(ContactFormView, self).form_valid(form)
91798
def validate_on_submit(self):
        

        # validate form
        valid = FlaskWtf.validate_on_submit(self)

        # return in case no schema or not submitted
        if not self._schema or not self.is_submitted():
            return valid

        # validate data with schema if got one and form was submitted
        data = dict()
        for field in self._fields:
            data[field] = self._fields[field].data

        result = self.schema.process(data, context=self._force_context)
        self.set_errors(result)

        # set filtered data back to form
        for field in data:
            self._fields[field].data = data[field]

        return valid and not bool(self.errors)
1019138
def validate_response(self):
        """"""
        if self.response is None:
            logger.error("Failed to submit")
            return False

        if not self.response:
            logger.error(
                "HTTP status %d: failed to submit to %s",
                self.response.status_code,
                self.response.url,
            )
            return False

        if not self.parsed_response:
            logger.error("Submit to %s failed, invalid response received", self.response.url)
            return False

        error_message = self.get_error_message()
        if error_message:
            logger.error("Submit to %s failed with error", self.response.url)
            logger.debug("Error message: %s", error_message)
            return False

        if not self.job_ids:
            logger.error("Submit to %s failed to get job id", self.response.url)
            return False

        logger.info("Results received by the Importer (HTTP status %d)", self.response.status_code)
        logger.info("Job IDs: %s", self.job_ids)

        return True
565984
function() {
			/// <summary>
			/// Validates the form, returns true if it is valid, false otherwise.
			/// This behaves as a normal submit event, but returns the result.
			/// </summary>
			/// <returns type="Boolean" />

			this.checkForm();
			$.extend(this.submitted, this.errorMap);
			this.invalid = $.extend({}, this.errorMap);
			if (!this.valid())
				$(this.currentForm).triggerHandler("invalid-form", [this]);
			this.showErrors();
			return this.valid();
		}
365638
def form_valid(self, form):
        """"""
        LOGGER.debug('termsandconditions.views.EmailTermsView.form_valid')

        template = get_template("termsandconditions/tc_email_terms.html")
        template_rendered = template.render({"terms": form.cleaned_data.get('terms')})

        LOGGER.debug("Email Terms Body:")
        LOGGER.debug(template_rendered)

        try:
            send_mail(form.cleaned_data.get('email_subject', _('Terms')),
                      template_rendered,
                      settings.DEFAULT_FROM_EMAIL,
                      [form.cleaned_data.get('email_address')],
                      fail_silently=False)
            messages.add_message(self.request, messages.INFO, _("Terms and Conditions Sent."))
        except SMTPException:  # pragma: no cover
            messages.add_message(self.request, messages.ERROR, _("An Error Occurred Sending Your Message."))

        self.success_url = form.cleaned_data.get('returnTo', '/') or '/'

        return super(EmailTermsView, self).form_valid(form)
670061
def form_valid(self, form):
        """"""

        form_valid_from_parent = super(HostCreate, self).form_valid(form)
        messages.success(self.request, 'Host {} Successfully Created'.format(self.object))

        return form_valid_from_parent
417167
def form_valid(self, form):
        """"""

        ret = super(ProjectCreate, self).form_valid(form)

        # Good to make note of that
        messages.add_message(self.request, messages.SUCCESS, 'Project %s created' % self.object.name)

        return ret
868796
function renderResponse(res, postUrl) {
    options.fault = options.fault || {};

    var fault = templates['soapFault']({
      code:         options.fault.code,
      description:  options.fault.description
    });

    var form = options.formTemplate ?
      interpolate(options.formTemplate) : templates[(!options.plain_form ? 'form' : 'form_el')];

    res.set('Content-Type', 'text/html');
    res.send(form({
      callback: postUrl,
      wctx:     options.wctx,
      wresult:  fault
    }));
  }
321090
def form_valid(self, form):
        
        self.object = form.save(commit=False)
        self.pre_save()
        self.object.save()
        if hasattr(form, 'save_m2m'):
            form.save_m2m()
        self.post_save()

        if self.request.is_ajax():
            return self.render_json_response(self.get_success_result())
        return HttpResponseRedirect(self.get_success_url())
1251718
def checkResponse(request):
        '''
        
        '''

        # Check the status code of the returned request
        if str(request.status_code)[0] not in ['2', '3']:
            w = str(request.text).split('\\r')[0][2:]
            raise InvalidRequest(w)
        return
570596
private static function validation() {
        if (isset(self::$config['validators'])) {
            $validators = self::$config['validators'];
        }
        else {
            $validators = true;
        }

        // action name validation
        if ($validators === true || (!isset($validators['actionName']) || $validators['actionName'] === true)) {
            if (substr(PHPMVC_ACTION, 0, 2) == '__') {
                throw new ActionNameValidationException();
            }
        }

        // request verification token
        $antiForgeryTokenForAction = InternalHelper::getStaticPropertyValue('\\PhpMvc\\ValidateAntiForgeryToken', 'enable');
        if ($antiForgeryTokenForAction === true || (($validators === true || (!isset($validators['antiForgeryToken']) || $validators['antiForgeryToken'] === true)) && $antiForgeryTokenForAction !== false)) {
            $request = self::$config['httpContext']->getRequest();

            if ($request->isPost()) {
                $post = $request->post();
                $expected = $request->cookies('__requestVerificationToken');

                if (!isset($post)) { $post = array(); }

                if (
                    (isset($expected) && $expected !== 'false' && (!isset($post['__requestVerificationToken']) || $post['__requestVerificationToken'] != $expected)) ||
                    (isset($expected) && $expected === 'false' && !empty($post['__requestVerificationToken'])) ||
                    (isset($post['__requestVerificationToken']) && empty($expected))
                   ) {
                    throw new HttpAntiForgeryException();
                }
            }
        }

        // cross site scripting validation
        if ($validators === true || (!isset($validators['crossSiteScripting']) || $validators['crossSiteScripting'] === true)) {
            $request = self::$config['httpContext']->getRequest();

            $get = $request->get();
            $post = $request->post();

            if (!isset($get)) { $get = array(); }
            if (!isset($post)) { $post = array(); }

            $items = array_merge($get, $post);

            foreach ($items as $key => $value) {
                $isDangerousString = CrossSiteScriptingValidation::IsDangerousString($key) || CrossSiteScriptingValidation::IsDangerousString($value);
    
                if ($isDangerousString) {
                    $source = null;

                    if (!empty($get[$key])) {
                        $source = '$_GET';
                    }
                    elseif (!empty($post[$key])) {
                        $source = '$_POST';
                    }
    
                    throw new HttpRequestValidationException($source, $key, $value);
                }
            }
        }
    }