question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example how to configure a custom validator

See original GitHub issue

In our case the form schema is loaded through AJAX and a field defines a validator like

  validator: 'my_validators.is_int'

I have a my_validators.js file which is loaded from the HTML (no JS packaging involved) like

<script type="module" src="my_validators.js"></script>

How can I attach/export my implementation of is_int()

function is_int(value) {
   // do something
}

as module in order to make it visible to VFG?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
wenzhixincommented, Oct 4, 2019

@vahidalvandi

const resources = {...}
Object.assign(VueFormGenerator.validators.resources, resources)
1reaction
vahidalvandicommented, Oct 27, 2018

not work for me !!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Custom Form Validators: Complete Guide
a custom validator is a function that validates the value of a form field according to a business rule, such as form example...
Read more >
The best way to implement custom validators - Angular inDepth
First, we will have a look at some built-in operators and then learn how to implement a custom validator on our own (this...
Read more >
How to Create Custom Validators in Angular - DZone
Create a factory function and pass parameters that will be passed to the custom validator to this function. · The return type of...
Read more >
Validating form input - Angular
In this example, the name control sets up two built-in validators — Validators.required and Validators.minLength(4) — and one custom validator, ...
Read more >
Creating a custom validator - FormValidation
Registering custom validator. There are two ways to reuse a custom validator. Adding to FormValidation.validators namespace.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found