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

Calendar: id and name should be passed to the input if provided #5711

Open
trajano opened this issue May 9, 2024 · 3 comments
Open

Calendar: id and name should be passed to the input if provided #5711

trajano opened this issue May 9, 2024 · 3 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@trajano
Copy link

trajano commented May 9, 2024

Describe the bug

When using PrimeVue to augment an existing web app. It doesn't pass the value of the calendar field because the name property is kept on the span and not pushed to the underling input field

Reproducer

https://jsfiddle.net/hjobdmay/

PrimeVue version

3.52

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

  1. https://jsfiddle.net/hjobdmay/
  2. fill in a date and text
  3. click submit

Expected behavior

date value should be provided

@trajano trajano added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 9, 2024
@trajano
Copy link
Author

trajano commented May 9, 2024

The workaround for those who need it is to add a hidden field like this

<p-calendar v-model="date" date-format="yy-mm-dd" :manualInput="true" :showOnFocus="false"></p-calendar>

<input type="hidden" name="date" :value="date?.toLocaleDateString()" />

@trajano
Copy link
Author

trajano commented May 9, 2024

It appears that id is not passed in either which means label for="idRef" will not work

@trajano trajano changed the title Calendar: name should be passed to the input if provided Calendar: id and name should be passed to the input if provided May 10, 2024
@m-meier
Copy link
Contributor

m-meier commented May 21, 2024

For id there's the inputId property. Unfortunately there is no equivalent for the name, however you could use the passthrough feature instead of a hidden input:
<p-calendar v-model="date" input-id="myinput" pt:input:name="test123" date-format="yy-mm-dd" :manualInput="true" :showOnFocus="false"></p-calendar>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

2 participants