Open Closed

How to override validation error messages #5040


User avatar
0
aaguiar created

I need to show Field name is required instead of This field is required how can I achieve that?

Here is a piece of code:

this.form = this.fb.group({
      name: [name ?? null, [Validators.required, Validators.maxLength(50)]],
      status: [status ?? null, []],
      goLiveDate: [goLiveDate ?? null, [Validators.required]],
      abn: [abn ?? null, [Validators.maxLength(50)]],
      paymentServices: this.fb.array(paymentServices ?? [], [this.requireAtLeastOne()]),
      logoUrl: [logoUrl ?? null, []],
      formId: [formId ?? null, [Validators.required]],
    });

In this case I would like to show Name is required but it should read from my translation file instead of hardcode the message, any idea?

  • ABP Framework version: v7.1.1
  • UI type: Angular
  • DB provider: MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

1 Answer(s)
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11