RFC: register input value transformation #3495
Replies: 4 comments 5 replies
-
@stramel you may be interested in this one as well. |
Beta Was this translation helpful? Give feedback.
-
@bluebill1049 Thanks for this RFC! I'm all in for the Some questions —
|
Beta Was this translation helpful? Give feedback.
-
I like the |
Beta Was this translation helpful? Give feedback.
-
This is going live with 6.12.0 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
Input value transform is always a headache for every developer, while this is not going to be a complete solution to solve all the use cases, but it's a step ahead in the right direction. We will focus on
register
function to start with and stay close and aligned with web standard: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElementPros
Cons
Proposal
new config
valueAsNumber
,valueAsDate
as part of the register options payload.Option A
Option B
Potential extra option
This way the user is more flexible in terms of retrieving input values, eg:
valueAsBoolean
is not a standard, so we can't include that as an option, but the user can usesetValueAs
callback to transform the value.Important Notes
Implementation
The complexity of this feature should be at the medium level, we just have to confirm the API decision and write unit tests for the implementation itself.
PR: #3489
Poll result
Beta Was this translation helpful? Give feedback.
All reactions