Private: Tries to find if an attribute is required in the form object.

 Returns Boolean.
974983
def attribute_required?(attribute)
      validator = find_validator(attribute, ActiveModel::Validations::PresenceValidator) ||
                  find_validator(attribute, TranslatablePresenceValidator)

      return unless validator

      # Check if the if condition is present and it evaluates to true
      if_condition = validator.options[:if]
      validator_if_condition = if_condition.nil? ||
                               (string_or_symbol?(if_condition) ? object.send(if_condition) : if_condition.call(object))

      # Check if the unless condition is present and it evaluates to false
      unless_condition = validator.options[:unless]
      validator_unless_condition = unless_condition.nil? ||
                                   (string_or_symbol?(unless_condition) ? !object.send(unless_condition) : !unless_condition.call(object))

      validator_if_condition && validator_unless_condition
    end
512921
def make_form_or_formset_fields_not_required(form_or_formset):
    """"""
    if isinstance(form_or_formset, BaseFormSet):
        for single_form in form_or_formset:
            make_form_fields_not_required(single_form)
    else:
        make_form_fields_not_required(form_or_formset)
948262
def _validate_required(self, attributes):
        """"""
        required_fulfilled = set(self._required).issubset(set(attributes))
        if not required_fulfilled:
            raise ValueError(
                "Not all required attributes fulfilled. Required: {required}".format(required=set(self._required))
            )
394617
private boolean isRequiredViaNestedRequiredValidator() {
        boolean result = false;
        if (null == validators) {
            return result;
        }
        Iterator<Validator> iter = validators.iterator();
        while (iter.hasNext()) {
            if (iter.next() instanceof RequiredValidator) {
                // See JAVASERVERFACES-2526.  Note that we can assume
                // that at this point the validator is not disabled, 
                // so the mere existence of the validator implies it is
                // enabled.
                result = true;
                Object submittedValue = getSubmittedValue();
                if (submittedValue == null) {
                    // JAVASERVERFACES-3058 asserts that view parameters 
                    // should be treated differently than form parameters
                    // if they are not submitted.  I'm not sure if that's 
                    // correct, but let's put this in and see how 
                    // the community responds.
                    this.setSubmittedValue("");
                }
                break;
            }
        }
                
        return result;
    }
1069422
function ( obj ) {
		return obj.nodeName === "FORM" ? false : validate.test( {alphanum  : obj.value || element.text( obj )} ).pass;
	}
200601
def validate(self):
        
        required_fields = list(filter(lambda x: self._fields[x], self._fields.keys()))
        for field in (self._top_fields + required_fields):
            if not hasattr(self, field) or hasattr(self, field) and getattr(self, field) == None:
                raise MissingFieldError(field)
1105576
def is_required(action):
  ''' '''
  return not action.option_strings and not isinstance(action, _SubParsersAction) or action.required == True
130955
function hasAllRequired( rule, element ) {
		if ( rule.nothingRequired )
			return true;

		var i, req, reqs, existing;

		if ( ( reqs = rule.requiredClasses ) ) {
			existing = element.classes;
			for ( i = 0; i < reqs.length; ++i ) {
				req = reqs[ i ];
				if ( typeof req == 'string' ) {
					if ( CKEDITOR.tools.indexOf( existing, req ) == -1 )
						return false;
				}
				// This means regexp.
				else {
					if ( !CKEDITOR.tools.checkIfAnyArrayItemMatches( existing, req ) )
						return false;
				}
			}
		}

		return hasAllRequiredInHash( element.styles, rule.requiredStyles ) &&
			hasAllRequiredInHash( element.attributes, rule.requiredAttributes );
	}
778383
def check_required_params(self):
        
        for param in self.REQUIRED_FIELDS:
            if param not in self.params:
                raise ValidationError("Missing parameter: {}".format(param))
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;

        }
1341523
def validate(form)
      fields = fields_to_validate
      return form  if fields.empty?

      validate_presence_of_required_fields form, fields

      fields.each_pair do |key, opts|
        next  if !form.has_key?(key) || form[key].nil?

        form[key] = validate_re key, form[key], opts
        form[key] = validate_iso_date key, form[key], opts
        form[key] = validate_ipaddr key, form[key], opts
      end

      form
    end
1264566
def ValidateRequiredFieldsAreNotEmpty(gtfs_object, required_field_names,
                                      problems=None):
  
  no_missing_value = True
  for name in required_field_names:
    if IsEmpty(getattr(gtfs_object, name, None)):
      if problems:
        problems.MissingValue(name)
      no_missing_value = False
  return no_missing_value
719336
def verify(self, **kwargs):
        
        _spec = self.c_param
        try:
            _allowed = self.c_allowed_values
        except KeyError:
            _allowed = {}

        for (attribute, (typ, required, _, _, na)) in _spec.items():
            if attribute == "*":
                continue

            try:
                val = self._dict[attribute]
            except KeyError:
                if required:
                    raise MissingRequiredAttribute("%s" % attribute)
                continue
            else:
                if typ == bool:
                    pass
                elif not val:
                    if required:
                        raise MissingRequiredAttribute("%s" % attribute)
                    continue

            try:
                _allowed_val = _allowed[attribute]
            except KeyError:
                pass
            else:
                if not self._type_check(typ, _allowed_val, val, na):
                    raise NotAllowedValue(val)

        return True
340998
def validate(self):
        

        missing = self.missing_property_names()

        if len(missing) > 0:
            raise validators.ValidationError(
                "'{0}' are required attributes for {1}"
                            .format(missing, self.__class__.__name__))

        for prop, val in six.iteritems(self._properties):
            if val is None:
                continue

            if isinstance(val, ProtocolBase):
                val.validate()
            elif getattr(val, 'isLiteralClass', None) is True:
                val.validate()
            elif isinstance(val, list):
                for subval in val:
                  subval.validate()
            else:
                # This object is of the wrong type, but just try setting it
                # The property setter will enforce its correctness
                # and handily coerce its type at the same time
                setattr(self, prop, val)

        return True
1330339
def _get_form(self, config_name, only_required=False):
        """"""
        if getattr(self, config_name, None):
            return import_object_by_string(getattr(self, config_name))

        def use_field(field):
            if not only_required:
                return True
            return field.default == NOT_PROVIDED

        return modelform_factory(self.model, fields=[f.name for f in self.model.get_fields() if use_field(f)])
1225502
def validate(self, name, value):
        
        validator = self.attribute_validators.get(name, None)
        if validator:
            return True if validator(value) else False
        return True
819410
function(attr) {
        if (!arguments.length) {
          return !_.isEmpty(this.changed);
        }
        return this.changed && _.has(this.changed, attr);
      }