Prepare the formview's default render context
@method prepare
@return {Object}
{Object.errors} A hash of field names mapped to error messages
{Object.success} A boolean value of true if validation has succeeded
420671
function() {
      var templateContext = View.prototype.prepare.apply(this);
      templateContext.formErrors = (_.size(this._errors) !== 0) ? this._errors : null;
      templateContext.formSuccess = this._success;
      return templateContext;
    }
322593
function validateForm() {

            var isValid = isEmpty(errors);

            formData = {};

            $.each(
                node.find('input:not([type="submit"]), select, textarea').not(':disabled'),
                function(index, input) {

                    input = $(input);

                    var value = _getInputValue(input[0]),
                        inputName = input.attr('name');

                    if (inputName) {
                        if (/\[]$/.test(inputName)) {
                            inputName = inputName.replace(/\[]$/, '');
                            if (!(formData[inputName] instanceof Array)) {
                                formData[inputName] = [];
                            }
                            formData[inputName].push(value)
                        } else {
                            formData[inputName] = value;
                        }
                    }

                    if (!!input.attr(_data.validation) || !!input.attr(_data.regex)) {
                        if (!validateInput(input[0], value)) {
                            isValid = false;
                        }
                    }
                }
            );

            prepareFormData();

            return isValid;

        }
1257759
public function render()
    {
        $field = $this->getParameter('field');

        $mode = $this->getParameter('mode');
        $mode = $mode == null ? 'list' : $mode;

        $css = $this->getParameter('css');

        $prefix = $this->getParameter('prefix');
        $prefix = $prefix == null ? '' : $prefix;

        $postfix = $this->getParameter('postfix');
        $postfix = $postfix == null ? '' : $postfix;

        $errors = $this->getGlobal('Errors'); //array of FieldValidationError or ValidationError


        if(empty($errors)) return '';


        if(empty($field)) {

            $s = '';

            if($mode == 'list') {
                $s = "<ul";
                if(!empty($css))
                    $s .= " class=\"{$css}\"";
                $s .= ">\n";
            }

            $cnt = 0;
            foreach($errors as $error) {
                if(!($error instanceof ValidationError)) continue;

                $msg = $this->errorCodeResolver->resolveMessageCode(
                    $error->getErrorCode(),
                    null,
                    null,
                    null,
                    $error->getDefaultErrorMessage());

                if($mode == 'br')
                    $s .= "{$prefix}{$msg}{$postfix}<br/>\n";
                else if($mode == 'list')
                    $s .= "<li>{$prefix}{$msg}{$postfix}</li>\n";
                $cnt++;
            }

            //none of the errors were global errors, try specifying the 'field' parameter
            if($cnt == 0)
                return '';

            if($mode == 'list')
                $s .= "</ul>\n";

            return $s;

        } else {

            foreach($errors as $error) {
                if(!($error instanceof FieldValidationError)) continue;

                if($field == $error->getFailureCode()) {

                    $msg = $this->errorCodeResolver->resolveMessageCode(
                        $error->getFailureCode(),
                        $error->getFieldResolved(),
                        $error->getFieldType(),
                        array(
                            $error->getFieldTitle(),
                            $error->getValue(),
                            $error->getFieldType()
                        ),
                        $error->getDefaultErrorMessage());

                    if(!empty($css))
                        return "<span class=\"{$css}\">{$msg}</span>";

                    return $msg;
                }
            }

        }

        return '';
    }
219324
def render_layout(self, form, context):
        
        form.rendered_fields = []
        
        html = self.layout.render(form, self.form_style, context)

        for field in form.fields.keys():
            if not field in form.rendered_fields:
                html += render_field(field, form, self.form_style, context)

        return mark_safe(html)
576804
function prepareHtmlTemplateContext() {

			var context = prepareBaseTemplateContext();

			var htmlStyles;

			// Prepare relative font paths for injection into @font-face refs in HTML
			var relativeRe = new RegExp(_s.escapeRegExp(o.relativeFontPath), 'g');
			var htmlRelativeFontPath = normalizePath(path.relative(o.destHtml, o.dest));
			var _fontSrc1 = o.fontSrc1.replace(relativeRe, htmlRelativeFontPath);
			var _fontSrc2 = o.fontSrc2.replace(relativeRe, htmlRelativeFontPath);

			_.extend(context, {
				fontSrc1: _fontSrc1,
				fontSrc2: _fontSrc2,
				fontfaceStyles: true,
				baseStyles: true,
				extraStyles: false,
				iconsStyles: true,
				stylesheet: 'css'
			});

			// Prepares CSS for injection into <style> tag at to of HTML
			htmlStyles = renderTemplate(o.cssTemplate, context);
			_.extend(context, {
				styles: htmlStyles
			});

			return context;
		}
1121754
def render_or_default(name, args = {})
      render name, args
    rescue ActionView::MissingTemplate
      render args.merge(:template => "#{self.class.default_views}/#{name}", :prefix => '')
    end
947543
function setFieldError (error) {
    // set path properties for error
    this.setErrorPath(error)
    // get field from error path and missing property name
    var field = this.getErrorField(error)
    // get error message based on error and custom messages on model
    var message = this.getErrorMessage(error)
    // if field is found and not hidden then add error to field
    if (field && !field.hidden) {
        // clear value from field - setting to default or undefined
        field.value = field.default
        // set error message on field
        field.error = message
    }
    // if not specific field set general error on field
    else {
        this.errors.push(message)
    }
}
1176526
def configure_error_handlers(app):
    

    def render_error(error):
        return (render_template('errors/%s.html' % error.code,
                title=error_messages[error.code], code=error.code), error.code)

    for (errcode, title) in error_messages.iteritems():
        app.errorhandler(errcode)(render_error)
691940
def _get_render_prepared_object(cls, context, **option_values):
        
        ctx_vals = cls._create_contextualvals_obj_from_context(context)
        opt_vals = cls._create_optionvals_obj_from_values(**option_values)

        if issubclass(cls, models.Model):
            instance = cls.get_from_collected_values(ctx_vals, opt_vals)
        else:
            instance = cls.create_from_collected_values(ctx_vals, opt_vals)
        if not instance:
            return None

        instance.prepare_to_render(context['request'], ctx_vals, opt_vals)
        return instance
361445
def supress_form_field_errors
      original_proc = ActionView::Base.field_error_proc
      ActionView::Base.field_error_proc = proc { |input, _instance| input }
      yield
    ensure
      ActionView::Base.field_error_proc = original_proc
    end
1054534
function initModelValidate (args) {
    var controller = this
    var model = this.model
    // if model does not have schema do not add validate controller
    if (!model.schemaData) {
        return
    }
    // get accountId column
    var accountIdColumn = model.columnName('accountId') 
    // set role to authenticated if model requires account id
    var role = args.defaultRole || (accountIdColumn && model.columns[accountIdColumn].null === false ? 'authenticated' : 'all')
    // index inputs
    var input = {
        // validate schema data
        meta: 'query.meta',
    }
    // instance data is in body under model name
    input[model.name] = 'body.'+model.name
    // create path if it does not exist
    if (!this.paths['/validate']) {
        this.paths['/validate'] = {}
    }
    // add POST /validate handler
    this.paths['/validate'].post = [
        {
            before: function (args) {
                // do validation
                return beforeValidate(controller, args)
            },
            input: input,
            method: function (args) {
                // if before didnt have errors data is valid
                return {valid: true}
            },
            role: role,
            methodName: 'validate',
        },
    ]
}
610854
def setup_errors(app, error_template="error.html"):
    """"""
    def error_handler(error):
        if isinstance(error, HTTPException):
            description = error.get_description(request.environ)
            code = error.code
            name = error.name
        else:
            description = error
            code = 500
            name = "Internal Server Error"
        return render_template(error_template,
                               error=error,
                               code=code,
                               name=Markup(name),
                               description=Markup(description)), code

    for exception in default_exceptions:
        app.register_error_handler(exception, error_handler)
546971
function callValidate() {
    /* jshint validthis: true */
    var _validate = schemaObj.validate;
    var result = _validate.apply(this, arguments);
    callValidate.errors = _validate.errors;
    return result;
  }
626103
function SettingsErrorRenderer(err, req, res) {
    SettingsRenderer.call(this, req, res);
    Object.defineProperties(this, {
        err: {
            value: err || new Error()
        }
    });
    req.attrs.isErrorPage = true;
}
951628
function (form) {
              // Special case: if the user is being redirected to this page for the
              // first time, don't display any error.
              if (form.data && !form.data.password && !form.data.passwordAgain) {
                return helpers.render(req, res, view, { form: form, organization: req.organization });
              }

              var formErrors = helpers.collectFormErrors(form);
              helpers.render(req, res, view, { form: form, formErrors: formErrors });
            }
1308158
protected function prepareVars()
    {
        if ($this->formField->disabled) {
            $this->previewMode = true;
        }

        if ($this->previewMode) {
            $this->useCaption = false;
        }

        $this->vars['fileList'] = $fileList = $this->getFileList();
        $this->vars['singleFile'] = $fileList->first();
        $this->vars['displayMode'] = $this->getDisplayMode();
        $this->vars['emptyIcon'] = $this->getConfig('emptyIcon', 'icon-upload');
        $this->vars['imageHeight'] = $this->imageHeight;
        $this->vars['imageWidth'] = $this->imageWidth;
        $this->vars['acceptedFileTypes'] = $this->getAcceptedFileTypes(true);
        $this->vars['cssDimensions'] = $this->getCssDimensions();
        $this->vars['cssBlockDimensions'] = $this->getCssDimensions('block');
        $this->vars['useCaption'] = $this->useCaption;
        $this->vars['prompt'] = $this->getPromptText();
    }
971723
function() {

        var element = this.model;
        var markup = element.get('markup') || element.markup;
        if (!markup) throw new Error('dia.ElementView: markup required');
        if (Array.isArray(markup)) return this.renderJSONMarkup(markup);
        if (typeof markup === 'string') return this.renderStringMarkup(markup);
        throw new Error('dia.ElementView: invalid markup');
    }