primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Autocomplete input field not cleared or reset

Open thirumalai-kc opened this issue 9 years ago • 9 comments

Current behavior p-autocomplete input field is not cleared/reset to null if I dont select an option from suggestion

Expected behavior Input field should be reset to null

Minimal reproduction of the problem with instructions <p-autoComplete placeholder="Start typing name to see suggestions" formControlName="customerRequest" [suggestions]="customerResults" (completeMethod)="searchCustomer('customer_name', $event.query)" minLength="3" field="accountName" (onSelect)="setCustomerRequest($event)">

Start type 'abc' Do not choose a value from the option Perform clear (Here using clear button which invoke method to make customerRequest null)

Result: customerRequest (model) set to null but the input field is not cleared/reset.

Expected: Field should be reset to null.

If I select some value from the option and clear, field is reset to null. Please address this issue.

  • Angular version: 2.0.X
  • PrimeNG version: 4.0.X
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

thirumalai-kc avatar Jul 21 '17 13:07 thirumalai-kc

I see this exact problem as well. Upvoting for a fix.

mmlitvin avatar Aug 03 '17 20:08 mmlitvin

Upvoting for a fix as well.

pageii avatar Aug 09 '17 06:08 pageii

Tracked at #3479

cagataycivici avatar Aug 23 '17 10:08 cagataycivici

you referenced same ticket number ? where is this tracked ? and there's no 4.1.4 milestone , you refer to 4.2.0 rc1 ? thanks

huineng avatar Sep 11 '17 11:09 huineng

@cagataycivici fixed in v4.2.0 if [multiple]="false" but not if you use [multiple]="true"

kavoos avatar Sep 14 '17 10:09 kavoos

Bump :-) Doesn't seem to be fixed if not if you use [multiple]="true". Has anyone got a work-around, even changing the dom element?

JamboBuenna avatar Feb 02 '18 13:02 JamboBuenna

@cagataycivici Issue still exists (5.2.4) when you manually clear the input. Type 'a' / Select an option / FormModel updated / clear the input / focus out / the FormModel still contains the old selection and the valueChange observable does not emit the value. Workaround : use the onClear to manually set the formControl value to null...

JordanDurieux avatar Jul 25 '18 09:07 JordanDurieux

Still exists "primeng": "^6.1.4. I've two "autocomplete" and i clear manually. One clear and the another in screen continue with value. Even when binding variable is null

Faqtt0 avatar Sep 19 '18 13:09 Faqtt0

What was the fix for this? I'm still experiencing this issue and this is an old ticket that was closed. "primeng": "^10.0.3"

K-R0N avatar Dec 15 '22 16:12 K-R0N