Dropdown validation

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
ryghar
Posts: 2
Joined: 06 Oct 2021, 15:24

06 Nov 2021, 13:41

Hello,

How can I set a dropdown as required?
I am using CRUD template from Barcelona and when I put required in the p-dropdown I get this error:

Code: Select all

error TS2322: Type 'string' is not assignable to type 'boolean'.
the dropdown is:

Code: Select all

<p-dropdown [options]="regions" required [(ngModel)]="locacion.regin" placeholder="Select a Region" [showClear]="true" optionLabel="name" emptyMessage="No records" dataKey="id" [autoDisplayFirst]="false"></p-dropdown>
thanks.

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

11 Nov 2021, 09:31

Hi,

Did your try set required property like this;

Code: Select all

[required]="true";
Also, you can see details ; http://primefaces.org/primeng/showcase/#/dropdown

Best regards,
Merve Özçifçi

Post Reply

Return to “Barcelona - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests