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

InputText: Name attribute not applied when used outside of Form component #6737

Closed
robm-masabi opened this issue Nov 6, 2024 · 6 comments
Closed
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@robm-masabi
Copy link

Describe the bug

When you use an InputText component outside of a Form component - note the capital F here - (e.g. inside a native <form> element or otherwise) and you apply a name attribute to that InputText component, then the name attribute is not rendered in the resulting markup.

This is a regression from previous versions of Primevue, and is not mentioned in any changelog. Therefore, I'm assuming its a bug.

Examples on the component's documentation feature the component being used outside of the <Form> parent (e.g. within a <div>), and do not indicate that certain fields will only render within a given context.

Since names are used for native form submission, the removal of this functionality is, I believe, a breaking change.

Reproducer

https://stackblitz.com/edit/nlblb9-7eepxq?file=src%2FApp.vue,package.json

PrimeVue version

4.2.0

Vue version

4.x

Language

TypeScript

Build / Runtime

Nuxt

Browser(s)

No response

Steps to reproduce the behavior

Add a name attribute to an InputText element.

View the resulting HTML rendered.

NB: This also affects other input types too - but InputText is the most widely used and easy to reproduce.

Expected behavior

The name attribute set on the InputText element should appear on the input element in the HTML, as described in the documenation.

e.g.

<InputText name="some-value" v-model="exampleRef" /> 

...should render....

<input name="some-value />
@robm-masabi robm-masabi 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 6, 2024
@Arsolitt
Copy link

+1 same

@tugcekucukoglu tugcekucukoglu 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 Nov 14, 2024
@tugcekucukoglu tugcekucukoglu added this to the 4.3.0 milestone Nov 14, 2024
@galaxyblur
Copy link

Seeing this w/ Textarea, too -- presumably all form inputs. This prevents me from using a traditional form redirect action.

@kedrzu
Copy link

kedrzu commented Nov 20, 2024

As a workaround you can use pass through: https://primevue.org/passthrough/

<InputText pt:root:name="customName" ... />

@tugcekucukoglu
Copy link
Member

Fixed with #6891

@github-project-automation github-project-automation bot moved this to Done in PrimeVue Nov 29, 2024
@tugcekucukoglu tugcekucukoglu modified the milestones: 4.3.0, 4.2.5 Nov 29, 2024
@tugcekucukoglu tugcekucukoglu self-assigned this Nov 29, 2024
@github-project-automation github-project-automation bot moved this from Done to Review in PrimeVue Dec 12, 2024
@tugcekucukoglu tugcekucukoglu modified the milestones: 4.2.5, 4.3.0 Dec 12, 2024
@tugcekucukoglu tugcekucukoglu removed their assignment Dec 12, 2024
@gimler
Copy link

gimler commented Dec 13, 2024

pass through for DatePicker

<InputText pt:pcInputText:root:name="customName" ... />

@AntonLindell
Copy link

+1, this is still not working for me even after #6891.

Works with :pt:root:name="name" as said by others.

@mertsincan mertsincan modified the milestones: 4.3.1, 4.3.0 Jan 6, 2025
@mertsincan mertsincan self-assigned this Jan 6, 2025
@github-project-automation github-project-automation bot moved this from Review to Done in PrimeVue Jan 13, 2025
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

Successfully merging a pull request may close this issue.

8 participants