Skip to content

asynchronous validationValue #81

Description

@vanhumbeecka

Question.

For example: what if you want to check username availability, can you make an asynchronous call to the server to check the availability inside the 'validationValue' element?

The code below doesn't work because Meteor.call is asynchronous. What is best practice here?

ReactiveForms.createElement({
    template: 'UserNameInput',
    validationEvent: 'keyup',
    validationValue: function(el, clean, template) {
        var v = $(el).val();
        console.log(v);
        Meteor.call('isUsernameAvailable', v, function(err, result) {
            if (err) {
                Meteor.Error('could not check username availability.');
            }
            return result;
        });
    }
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions