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)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-rc.1. Updated on June 18, 2025, 12:26