AccountsTemplate


#1

I am using AccountsTemplate and validating if the user exists or not using the code below - pretty much similar what is in the docs . Issue i am facing is when the userexists , the registration form submit button is disabled . and user has no way to enter the text and submit again . Particularly in a mobile app this is really annoying as we have to close the app and reopen it again … I am assuming this has to be something very simple , can anyone help?

AccountsTemplates.addField({
_id: ‘username’,
type: ‘text’,
required: true,
func: function(value){
if (Meteor.isClient) {
console.log(“Validating username…”);
var self = this;
Meteor.call(“userExists”, value, function(err, userExists){
if (!userExists)
self.setSuccess();
else
self.setError(userExists);
self.setValidating(false);
});
return;
}

},

});