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

@primevue/forms: Form components submit event parameter missing values #7006

Open
root5427 opened this issue Dec 25, 2024 · 0 comments
Open
Assignees
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Milestone

Comments

@root5427
Copy link

Describe the bug

Prehistory

Documentation states that:

The submit callback returns an object that encapsulates the form's validity, any existing errors, and its current state. This enables access to the form values, validation status, and any errors present at the time of submission.

Also it states that:

// e.values: An object containing the current values of all form fields.

export interface FormSubmitEvent {
/**
* The original DOM event.
*/
originalEvent: Event;
/**
* The form values.
*/
values: Record<string, any>;
/**
* The form state.
*/
states: Record<string, FormFieldState>;
/**
* Whether the form is valid.
*/
valid: boolean;
/**
* The form errors.
*/
errors: any[];
/**
* Resets the form.
*/
reset: () => void;
}

const handleSubmit = (callback) => {
return async (event) => {
const results = await validateOn('validateOnSubmit', true);
return callback({
originalEvent: event,
valid: toValue(valid),
states: toValue(states),
reset,
...results
});
};
};

Actual issue:

An object returned by submit callback DOES NOT have values field.

Reproducer

https://stackblitz.com/edit/primevue-nuxt-issue-template-qsshy1rm?file=app.vue

PrimeVue version

4.2.5

Vue version

3.x

Language

TypeScript

Build / Runtime

Nuxt

Browser(s)

Chrome 131

Steps to reproduce the behavior

  1. Install @primevue/forms.
  2. Use the Form component in a Vue application.
  3. Attempt to use the submit event as described in the documentation.
  4. Observe that object returned by submit callback does not contain values

Expected behavior

Existence of values in an object returned by submit callback.

@root5427 root5427 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 25, 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 Dec 26, 2024
@tugcekucukoglu tugcekucukoglu added this to the 4.3.0 milestone Dec 26, 2024
@github-project-automation github-project-automation bot moved this to Review in PrimeVue Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Projects
Status: Review
Development

No branches or pull requests

3 participants