primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.6k stars 1.23k forks source link

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

Open robm-masabi opened 1 week ago

robm-masabi commented 1 week ago

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 />
Arsolitt commented 1 week ago

+1 same