How can I set customized validation error message for p-autocomplete field

UI Components for Angular
Post Reply
bipinbn
Posts: 1
Joined: 11 Feb 2017, 17:40

08 Jun 2018, 08:27

Hi,

I am using primeng version 4.2.2.

I have used p-autocomplete in angular 4. I have to set the custom validation error message for the field.
The field is required field, if user is not selected and hit enter I have to customize the error message in p-autocomplete.

Please guide me how I can set the customized validation error message. In default it's showing "Please fill out this field".

Code: Select all

	<p-autoComplete [(ngModel)]="name" [ngModelOptions]="{standalone: true}" [suggestions]="nameList" [required]="true" (completeMethod)="initializeNameList()" [size]="30" [minLength]="1" [dropdown]="true"  [forceSelection]="true" oninvalid="setCustomValidity('Please Select a Name.')" onchange="try{setCustomValidity('')}catch(e){}" placeholder="Type or Select">
	</p-autoComplete>
Thanks.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests