How to use the ember-changeset-validations/validators.validatePresence function in ember-changeset-validations

To help you get started, we’ve selected a few ember-changeset-validations examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adfinis-sygroup / ember-validated-form / tests / dummy / app / validations / user.js View on Github external
// BEGIN-SNIPPET quickstart-validations.js
import {
  validatePresence,
  validateLength,
  validateInclusion
} from "ember-changeset-validations/validators";

export default {
  firstName: [validatePresence(true), validateLength({ min: 3, max: 40 })],
  lastName: [validatePresence(true), validateLength({ min: 3, max: 40 })],
  aboutMe: [validateLength({ allowBlank: true, max: 200 })],
  country: [validatePresence(true)],
  gender: [validatePresence(true)],
  terms: [
    validateInclusion({
      list: [true],
      message: "Please accept the terms and conditions!"
    })
  ],
  color: [validatePresence(true)]
};
// END-SNIPPET
github skaterdav85 / ember-changeset-conditional-validations / tests / dummy / app / validations / settings.js View on Github external
import { validatePresence, validateLength } from 'ember-changeset-validations/validators';
import validateSometimes from 'ember-changeset-conditional-validations/validators/sometimes';

export default {
  paymentMethod: validatePresence(true),
  creditCardNumber: validateSometimes([
    validatePresence(true),
    validateLength({ is: 16 })
  ], function() {
    return this.get('paymentMethod') === 'credit-card';
  })
};
github poteto / ember-changeset-validations / tests / dummy / app / components / foo-bar.js View on Github external
import Component from '@ember/component';
import { validatePresence, validateLength } from 'ember-changeset-validations/validators';

const rulez = {
  firstName: [
    validatePresence(true),
    validateLength({ min: 2 })
  ],
  lastName: [
    validatePresence(true),
    validateLength({ min: 2 })
  ]
};

const schema = {
  firstName: null,
  lastName: null
};

export default Component.extend({
  rulez,
  schema
});
github puzzle / cryptopus / frontend / app / validations / file-entry.js View on Github external
import {
  validatePresence,
  validateLength
} from "ember-changeset-validations/validators";

export default {
  description: [validateLength({ max: 300 })],
  file: [validatePresence(true)]
};
github NYCPlanning / labs-zap-search / app / validations / recommendation.js View on Github external
dcpCommunityboardrecommendation: validatePresence({
    presence: false,
    message: recommendationPresenceMessage,
  }),
};

export const boroughPresidentDispositionValidations = {
  ...dispositionValidations,

  dcpBoroughpresidentrecommendation: validatePresence({
    presence: true,
    message: recommendationPresenceMessage,
  }),

  dcpBoroughboardrecommendation: validatePresence({
    presence: false,
    message: recommendationPresenceMessage,
  }),

  dcpCommunityboardrecommendation: validatePresence({
    presence: false,
    message: recommendationPresenceMessage,
  }),
};
github puzzle / cryptopus / frontend / app / validations / folder.js View on Github external
import {
  validatePresence,
  validateLength
} from "ember-changeset-validations/validators";

export default {
  name: [validatePresence(true), validateLength({ max: 40 })],
  description: [validateLength({ max: 4000 })],
  team: [validatePresence(true)]
};
github noironetworks / aci-containers / vendor / github.com / hashicorp / consul / ui-v2 / app / validations / intention.js View on Github external
import { validatePresence, validateLength } from 'ember-changeset-validations/validators';
import config from 'consul-ui/config/environment';
export default Object.assign(
  {
    SourceName: [validatePresence(true), validateLength({ min: 1 })],
    DestinationName: [validatePresence(true), validateLength({ min: 1 })],
    Action: validatePresence(true),
  },
  config.CONSUL_NAMESPACES_ENABLED
    ? {
        SourceNS: [validatePresence(true), validateLength({ min: 1 })],
        DestinationNS: [validatePresence(true), validateLength({ min: 1 })],
      }
    : {}
);
github hashicorp / consul / ui-v2 / app / validations / acl.js View on Github external
import { validatePresence, validateLength } from 'ember-changeset-validations/validators';
export default {
  Name: [validatePresence(true), validateLength({ min: 1 })],
  Type: validatePresence(true),
};
github NYCPlanning / labs-zap-search / app / validations / recommendation.js View on Github external
message: maxLengthMessage,
    }),
    validatePresenceUnlessValue({
      presence: true,
      unless: 'dcpCommunityboardrecommendation',
      value: 717170008,
      message: numberMessage,
    }),
    validateNumber({
      positive: true,
      allowBlank: true,
      message: numberMessage,
    }),
  ],

  dcpBoroughpresidentrecommendation: validatePresence({
    presence: false,
    message: recommendationPresenceMessage,
  }),

  dcpBoroughboardrecommendation: validatePresence({
    presence: false,
    message: recommendationPresenceMessage,
  }),

  dcpCommunityboardrecommendation: validatePresence({
    presence: true,
    message: recommendationPresenceMessage,
  }),
};

export const boroughBoardDispositionValidations = {