Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] dynamic rules from backend #437

Open
HiraveBapu opened this issue Feb 12, 2019 · 2 comments
Open

[question] dynamic rules from backend #437

HiraveBapu opened this issue Feb 12, 2019 · 2 comments
Labels

Comments

@HiraveBapu
Copy link

HiraveBapu commented Feb 12, 2019

I am defining the validation rules (object) on backend. During the initialization of vuex store, it downloads the rules form api. and for form validation, i am trying to use the vuex stored rules (object).

i am getting errors about - vue.esm.js:628 [Vue warn]: Error in render: "RangeError: Maximum call stack size exceeded"

here is my complete code:


// Mixin

export default {
  name: 'DataModelValidator',
  data: () => ({
    rules: {},
  }),
  computed: {
    validations: function() {
      return {
        dataModel: this.rules,
      }
    },
  },
  created() {
    this.rules = deviceMgmtStoreHelper.deviceModelValidationRules
  },
}


// backend

  app.get('/api/devicerules', (request, response) => {
    let validation_rules = `{
      serial_number: {
        required,
        minLength: minLength(4),
      },
      device_id: {
        minLength: minLength(10),
      },
    }`

    response.json(validation_rules)
  })


<!--
IMPORTANT: Make sure that you are familiar with documentation before submitting an issue.

  https://monterail.github.io/vuelidate/

IMPORTANT: Please use the following jsfiddle to provide a reproduction of your problem

  https://jsfiddle.net/Frizi/b5v4faqf/

Issues without a working fiddle are generally much harder to solve and usually take much more time to actually do it.
-->
@rich25200
Copy link

I have similar problem. Did you resolve the problem?

@HiraveBapu
Copy link
Author

Using VeeValidate library I solved problem. Unfortunately I had to change library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants