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

fix(InputNumber): added "required" prop which is present in wrapped component (InputText) already #7063

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wasiqwiqar
Copy link

Problem

When used in a standard HTML <form> element, a required tag is only recognized by the InputText component and not by the InputNumber component.

Solution

Since the InputNumber component is simply a wrapper around the InputText component, which itself supports the required prop, this is a very straightforward fix of simply accepting and passing the props on to the wrapped components.

Existing Functionality

The allow-empty prop tackles this from a different direction, however it resets the input field to 0 if emptied, which is a separate behaviour. The required tag is recognized and validated natively by browsers, so it should be a part of all input fields, which is why this functionality is essential.

Copy link

vercel bot commented Jan 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Updated (UTC)
primevue ⬜️ Ignored (Inspect) Visit Preview Jan 8, 2025 4:43pm
primevue-v3 ⬜️ Ignored (Inspect) Visit Preview Jan 8, 2025 4:43pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants