Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autocomplete onModelChange should be be triggered onInput if forceSelection is true #4668

Closed
huineng opened this issue Dec 14, 2017 · 1 comment
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@huineng
Copy link

huineng commented Dec 14, 2017

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap

Current behavior

onModelChange is being emitted after each keystroke (input).. when forceselection is enabled this should not be the case

Expected behavior

in a reactive form we listen to form validations, when an autocomplete value is required, then we want only that control to be valid once the value is selected.

So the onmodelchange should be removed from the oninput if the forceselection is true
https://github.com/primefaces/primeng/blob/master/src/app/components/autocomplete/autocomplete.ts#L303

let value = (<HTMLInputElement> event.target).value;
        if(!this.multiple && ! this.forceSelection) {
            this.onModelChange(value);
        }
@cagataycivici cagataycivici self-assigned this Dec 19, 2017
@cagataycivici cagataycivici added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add Status: Pending Review Issue or pull request is being reviewed by Core Team labels Dec 19, 2017
@cagataycivici cagataycivici added this to the 5.1.0-RC1 milestone Dec 19, 2017
@cagataycivici cagataycivici removed the Status: Pending Review Issue or pull request is being reviewed by Core Team label Dec 20, 2017
@ghost
Copy link

ghost commented May 3, 2018

The problem with this is that if on the FormControl we have a required Validator if we write a value in autocomplete then manuall delete it (with backspace) the valueChanges is not fired on the form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

2 participants