You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to mobx-react-form error messages with validator plugin error messages? I'm using DVR and when field is validated error message is shown. If I change my localization, error message won't update because Field has its error property already set. This is my current implementation:
class FieldBase extends Field {
constructor(props) {
super(props);
validatorService.on('onMessageSourceChange', async () => {
if (this.showError) {
await this.validate();
this.showErrors(!this.isValid);
}
});
}
@computed get localizedError() {
return _.replace(this.error, /\[(.*)\]/, function (match, value) {
return localizationService.t(value);
})
}
}
Problem is that I need to force validate field again to get new error messages. Language is changed when validatorjs.useLang('language'); is called and validatorjs has its new messages after that but I can't immediatelly update displayed error message because Field is not synced. This is not a big problem for now, but I'm going to have async validations which might be a problem to re-validate.
Is there a way to call something like syncPluginErrorMessages() where Field or Form would update its error message? If not, is there a change something like this could be added?
Thank you.
The text was updated successfully, but these errors were encountered:
Is there a way to mobx-react-form error messages with validator plugin error messages? I'm using DVR and when field is validated error message is shown. If I change my localization, error message won't update because Field has its error property already set. This is my current implementation:
Problem is that I need to force validate field again to get new error messages. Language is changed when
validatorjs.useLang('language');
is called and validatorjs has its new messages after that but I can't immediatelly update displayed error message because Field is not synced. This is not a big problem for now, but I'm going to have async validations which might be a problem to re-validate.Is there a way to call something like syncPluginErrorMessages() where Field or Form would update its error message? If not, is there a change something like this could be added?
Thank you.
The text was updated successfully, but these errors were encountered: