Replies: 3 comments
|
Hi @Xidai, If the input is initially empty you can check on change if the value is empty or parsed to int if it's NaN. That's how native input also works: https://jsbin.com/babokidexe/1/ For me it seems reasonable to add something that might help with that validation. As in native works you can use :valid / :invalid selectors not only the value itself. |
|
I opened issue as a feature request from the discussion: #10479 |
|
Hi @Xidai, document.getElementById("inputId").addEventListener("focusout", (e) => { For CSS purposes the users can still use the CSS Part we are exposing, but they can only use it for styling the input not showing a value state message: Kind regards, |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Consider this scenario, there is a Input with type="Number", I only type '-' into the Input and focus out, the '-' is not a valid number, so the
event.target.valuereturns empty, but what we need is to highlight it with error state to tell the user this is not a valid number so that he/she should modify it. But I can not get the real input '-'. Is there any way I can achieve that?All reactions