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

Select filter in forms (FormField): The filter input is also invalid when select is invalid. #7052

Closed
4 tasks
JoseAntonioNavasSolutia opened this issue Jan 7, 2025 · 8 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@JoseAntonioNavasSolutia
Copy link

Describe the bug

When the select field is invalid, the select filter is also invalid. Also if we filter the filter value is the value of $field.value
filtro_select
filter_value_select

Pull Request Link

No response

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

No response

Reproducer

stackblitz don't work

Environment

Windows 11

Vue version

3.5.13

PrimeVue version

4.2.0

Node version

20.11.10

Browser(s)

Chrome

Steps to reproduce the behavior

.

Expected behavior

.

@JoseAntonioNavasSolutia JoseAntonioNavasSolutia added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 7, 2025
@JoseAntonioNavasSolutia
Copy link
Author

@david-rohrschneider
Copy link

Hello, I can confirm this. This is also a bigger issue - for multi select fields inside a form or form field, every checkbox and filter input is added to the form state. This breaks the entire form, which is why the select components are not usable with forms

@mertsincan mertsincan self-assigned this Jan 13, 2025
@mertsincan mertsincan added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 13, 2025
@mertsincan mertsincan added this to the 4.3.0 milestone Jan 13, 2025
@github-project-automation github-project-automation bot moved this to Review in PrimeVue Jan 13, 2025
@github-project-automation github-project-automation bot moved this from Review to Done in PrimeVue Jan 13, 2025
@cotufaloschiflones
Copy link

Hello @david-rohrschneider thats true, I have post something similar here: #7158

The select on filter create a 'undefined' field in the $form model just to check things etc, this is the main reason why the resolver is triggering, because Form component is updating internally the $form object exposed through v-slot (creating inside form a formfield object with the key undefined, and the value of the filter input text) and thats what is triggering the validation on the rest of the fields, even if they are pristine.

Because of that, I'm not able to validate every field when changes (only that field and only when modelValue of that field changes) and validate all fields on submit...which is the behaviour what I want

But anyways you still can remove the error style in the filter input with PT, like so:

:pt="{ pcfilter: { root: 'border border-secondary-0 hover:border-secondary-200 focus:border-secondary' }}"

Hello, I can confirm this. This is also a bigger issue - for multi select fields inside a form or form field, every checkbox and filter input is added to the form state. This breaks the entire form, which is why the select components are not usable with forms

@david-rohrschneider
Copy link

david-rohrschneider commented Feb 5, 2025

@cotufaloschiflones does not solve my Problem, since the select field needs to be validated for emptyness and i need the on-blur validation. Im sure this can be solved since other open source frameworks offer this functionality already. I didnt chrck but there was a PR fixing this here already

@cotufaloschiflones
Copy link

cotufaloschiflones commented Feb 5, 2025

@david-rohrschneider I know, the answer is for @JoseAntonioNavasSolutia to avoid the input filter state get marked as invalid (visually).

I was mentioning you because you were talking about the behaviour of select and filtering, because of that I post the answer, I just recently open an issue with this (#7193). But your problem is the same as mine (kind of), but we need primevue fix first how they are doing the filtering approach because it has some caveats or side effects

@david-rohrschneider
Copy link

@cotufaloschiflones i see, did you try it with latest PR?

@cotufaloschiflones
Copy link

@david-rohrschneider no, do you have the link to this PR? Im using the last version of primevue anyway

@david-rohrschneider
Copy link

@cotufaloschiflones i thought its this one but its not relevant it seems

c1f3bda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
Status: Done
Development

No branches or pull requests

4 participants