Validate each field
@returns {Boolean} true if all fields validate and required fields are not empty
3659
function() {
      var response = true;
      
      // Validate all the sub fields
      for (var i = 0 ; i < this.inputs.length ; i++) {
   	   var input = this.inputs[i];
   	   input.setClassFromState(); // update field classes (mark invalid fields...)
   	   var state = input.getState();
   	   if( state == inputEx.stateRequired || state == inputEx.stateInvalid ) {
   		   response = false; // but keep looping on fields to set classes
   	   }
      }
      return response;
   }
186335
function() {
    var self = this
    var validations = []

    return self
      .callInterceptors('beforeValidation', [self])
      .then(function() {
        for (var field in self.definition.validations) {
          var fieldValidations = self.definition.validations[field]

          // set the scope of all validator function to the current record
          for (var i in fieldValidations) {
            validations.push(fieldValidations[i].bind(self))
          }
        }
        return self.store.utils.parallel(validations)
      })
      .then(function(result) {
        if (self.errors.has) throw self.errors
      })
      .then(function() {
        return self.callInterceptors('afterValidation', [self])
      })
      .then(function() {
        return self
      })
  }
151048
public function validate($fields = [])
    {
        if (empty($this->rules())) return true;
        foreach ($this->rules() as $rules) {
            if (is_array($rules[0])) {
                foreach ($rules[0] as $v){
                    if(!empty($fields) && !in_array($v,$fields)) continue;
                    $this->_validate($rules,$v);
                }
            } else {
                if(!empty($fields) && !in_array($rules[0],$fields)) continue;
                $this->_validate($rules,$rules[0]);
            }
        }
        $attributes = $this->attributes();
        if(!empty($this->_validateError) && !empty($attributes)){
            foreach ($this->_validateError as $k=> &$v){
                if(strpos($v,':attribute')!==false){
                    $v = isset($attributes[$k])? str_replace(':attribute',$attributes[$k],$v) : $v;
                }
            }
        }
        return empty($this->_validateError);
    }
1237197
public function validate()
    {
        foreach ($this->getFields() as $field) {
            if (! isset($this->submittedData[$field->getName()])) {
                continue;
            }
            
            // is it mandatory and empty?
            if ($field->isMandatory() && strlen($this->submittedData[$field->getName()]) < 1) {
                $mandatory = new ValidationError($field, 'is mandatory');
                $field->addError($mandatory);

                // Go to the next field, no need to validate
                continue;
            }

            $validationResult = $field->validate();

            if ($validationResult) {
                $validationError = new ValidationError($field);
                $field->addError($validationError);
            }
        }
    }
799739
public function validate() {
    $arrErrors = array();

    $arrErrors = $this->validateFields();

    if (sizeof($arrErrors) > 0) {
      foreach ($arrErrors as $error) {
        $this->clientErrorMessage .= $error . " * ";
      }
      return false;
    }

    return true;
  }
241919
function() {
		if ( $(this[0]).is("form")) {
			return this.validate().form();
		} else {
			var valid = true;
			var validator = $(this[0].form).validate();
			this.each(function() {
				valid = valid && validator.element(this);
			});
			return valid;
		}
	}
583810
def validate_fields
      self.class.required_fields.each do |field|
        value = public_send(field)
        if value.nil? || value.respond_to?(:empty?) && value.empty?
          raise Outbox::MissingRequiredFieldError, "Missing required field: #{field}"
        end
      end
    end
793784
def is_valid(self):
        
        self.errors = []

        for field in self.get_all_field_names_declared_by_user():
            getattr(type(self), field).is_valid(self, type(self), field)
            field_errors = getattr(type(self), field).errors(self)
            self.errors.extend(field_errors)

        return len(self.errors) == 0
477279
function (validations) {
		if (!validations) {
			return this;
		}

		if (!this.validations) {
			this.validations = [];
		}

		var that = this;

		_.isArray(validations) || (validations = [ validations ]);

		_.each(validations, function (validation) {
			that.validations.push(validation);
		});

		return this;
	}
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;

        }
162782
public function isValid()
    {
        // these schemes are allowed
        $allowedSchemes = $this->getAllowedSchemes();

        // get the field value
        $url = $this->field->getValue();


        // not required and empty? Then its valid
        if ($this->isNotRequiredAndEmpty($url)) {
            return true;
        }

        if ($this->getMaxLength() && strlen($url) > $this->getMaxLength()) {
            // Over maximum length.
            return false;
        }

        // do simple validation
        if (!filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED | FILTER_FLAG_SCHEME_REQUIRED)) {
            return false;
        }

        // check if we have a tld
        if (!$this->isSkipTldCheck() && !preg_match('#\.[a-z]{2,}$#', parse_url($url, PHP_URL_HOST))) {
            return false;
        }

        // further validation is required.
        if (in_array(parse_url($url, PHP_URL_SCHEME), $allowedSchemes)) {
            return true;
        }

        return false;
    }
1238779
private function validateFields() {
    $fieldsRequired = $this->fieldsRequired;
    $returnError = array();

    foreach ($fieldsRequired as $field) {
      if (C2PValidate::isEmpty($this->{$field}) && (!is_numeric($this->{$field})))
        $returnError[] = $field . ' is empty';
    }

    foreach ($this->fieldsSize as $field => $size) {
      if (isset($this->{$field}) && C2PValidate::strlen($this->{$field}) > $size)
        $returnError[] = $field . ' Length ' . $size;
    }

    foreach ($this->fieldsValidate as $field => $method) {
      if (!C2PValidate::isEmpty($this->{$field}) && !call_user_func(array('PayXpert\Connect2Pay\C2PValidate', $method), $this->{$field}))
        $returnError[] = $field . ' = ' . $this->{$field};
    }

    return $returnError;
  }
1246312
protected function validate()
    {
        foreach ($this->_requiredAttr as $attr) {
            if (is_array($attr)) {
                $valid = false;
                foreach ($attr as $sub) {
                    if (!is_null($this->$sub)) {
                        $valid = true;
                        break;
                    }
                }
                if (!$valid) {
                    return false;
                }
            } elseif (is_null($this->$attr)) {
                return false;
            }
        }
        return true;
    }
427691
public void validateAllFields() {

        CmsValidationController validationController = new CmsValidationController(
            m_fields.values(),
            createValidationHandler());
        validationController.setFormValidator(m_validatorClass);
        validationController.setFormValidatorConfig(createValidatorConfig());
        startValidation(validationController);
    }
705463
function validate (schema, data, key) {
  let value = data[key]
  const bool = value == null || value === ''
  const { required, type, validate, transform, elements } = schema
  const def = schema['default']
  // trigger error if undefined but required
  if (required && bool) throw new Error(`field ${key} is missing`)
  // coerce to type
  if (type && !bool) {
    let before = coerce(type, key, value)
    data[key] = elements
      ? (type === 'object' ? validator(before, elements) : before.map(item => validator(item, elements)))
      : before
  }
  // validate value
  if (validate) {
    const cb = check(validate, key)
    if (type === 'array') value.map(cb)
    else cb(value)
  }
  // apply default value
  if (def && bool) data[key] = def
  // apply transform
  if (transform && def == null) {
    data[key] = typeof transform === 'function'
      ? (type === 'array' ? value.map(transform) : transform(value))
      : transform
  }
}
984587
function validation() {
  const target = this._obj;
  this.assert(_.isObject(target), '#{this} is not a Joi validation because it must be an object');
  this.assert(!_.isEmpty(target), '#{this} is not a Joi validation because it is an empty object');
  const fields = _.keys(target);
  const allFieldsPresent = _.every(FIELDS_TO_VALIDATE.map(field => _.includes(fields, field)));

  this.assert(
    allFieldsPresent,
    `${this} is not a validation because it does not contain expected keys`
  );
}
939206
public boolean noFieldsInvalid(Collection<I_CmsFormField> fields) {

        for (I_CmsFormField field : fields) {
            if (field.getValidationStatus().equals(I_CmsFormField.ValidationStatus.invalid)) {
                return false;
            }
        }
        return true;
    }