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

Forms: The form reset function doesn't work correctly. No component refresh #6873

Closed
vkovalev-mjhs opened this issue Nov 26, 2024 · 5 comments
Assignees
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted

Comments

@vkovalev-mjhs
Copy link

Describe the bug

All form components doesn't refresh presentation and do not call resolver. Form field values have changed , but the representation is same. After reset we MUST call resolver to update states!

In 4.2.3 same.

Reproducer

https://stackblitz.com/edit/u1atdw?file=src%2FApp.vue

PrimeVue version

4.2.2

Vue version

4.x

Language

ES6

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

Enter a text. Click the button. Form field value has changed (see console
output), but the representation is same. And after reset we MUST call
resolver to update states!

Expected behavior

No response

@vkovalev-mjhs vkovalev-mjhs added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 26, 2024
@tugcekucukoglu tugcekucukoglu added this to the 4.3.0 milestone Nov 29, 2024
@tugcekucukoglu tugcekucukoglu added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 29, 2024
@Mbyvz
Copy link

Mbyvz commented Nov 29, 2024

<Form v-slot="$form" :initialValues :resolver  @submit="onFormSubmit">
      <InputText v-model="formData.title" name="title" type="text" placeholder="Title"/>
      <Message v-if="$form.title?.invalid" severity="error" size="small" variant="simple">{{ $form.title.error.message }}</Message>
</Form>

When formData.title is changed externally, it is not updated. $form.title is not updating.
Is it possible to improve the issue?

@vkovalev-mjhs
Copy link
Author

vkovalev-mjhs commented Nov 29, 2024

And, please, add a <InputHidden/> component for forms, not all submitting fields are visible.

@vkovalev-mjhs
Copy link
Author

vkovalev-mjhs commented Dec 5, 2024

I found a temporary way to update a component value with visible change. It could be a clue to the bug fix.
I.e. The <Select> component. I created an extended component <FixedSelect> and added a method setValue(value)

<template>
  <Select v-bind="$attrs" ref="field"/>
<template>
export default {
  name: 'FixedSelect',
  extends: Select,
  methods: {
    setValue(value) {
       this.$refs.field.updateModel(null, value)
    }
  }
}

@mertsincan mertsincan modified the milestones: 4.3.1, 4.3.0 Jan 6, 2025
@mertsincan mertsincan moved this to Review in PrimeVue Jan 6, 2025
@mertsincan mertsincan self-assigned this Jan 6, 2025
@mertsincan
Copy link
Member

Fixed in #6755

@github-project-automation github-project-automation bot moved this from Review to Done in PrimeVue Jan 6, 2025
@mertsincan mertsincan added Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Jan 6, 2025
@mertsincan mertsincan removed this from the 4.3.0 milestone Jan 6, 2025
Copy link

github-actions bot commented Jan 6, 2025

This issue has been marked as a duplicate and has been closed. Please refer to the original issue for updates. Thank you!

@mertsincan mertsincan removed this from PrimeVue Jan 6, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted
Projects
None yet
Development

No branches or pull requests

4 participants