-
Notifications
You must be signed in to change notification settings - Fork 104
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
onInvalid never triggered #114
Comments
any update on this .. how to mark control as invalid? |
I had the same issue with So... after some work, I found an alternative solution for warning messages.
export const QuantityPicker: React.FC<QuantityPickerProps> = ({value, min, max, newValue}) => {
const inputValue = value ? value : 0;
const inputMin = min ? min : 0;
const inputMax = max ? max : 10;
return (
<div>
<div style={{maxWidth: 112}}>
{min && max && min === max ? (
<input type="number" value={1} style={{maxWidth: 112, textAlign: 'center'}} disabled />
) : (
<NumericInput
className="form-control"
value={inputValue}
min={inputMin}
max={inputMax}
onChange={(value: number | null) => newValue({value, min: inputMin, max: inputMax})}
size={5}
mobile
required
/>
)}
</div>
</div>
);
};
onChange={(value: number | null) => newValue({value, min: inputMin, max: inputMax})}
<QuantityPicker value={0} min={modifier.minQty} max={modifier.maxQty} newValue={handleQuantityError} /> const handleQuantityMessage = ({
value,
min,
max,
}: QuantityMessageProps): void => {
if (value === max) {
console.log("## WARNING: You on the MAX limit");
}
if (value === min) {
console.log("## WARNING: You on the MIN limit");
}
console.log("FINE:", value, min, max);
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I’m having trouble triggering the onInvalid event in my NumericInput, which is a simple react-numeric-input.
The documentation (https://www.npmjs.com/package/react-numeric-input) states that onInvalid will be called with errorMessage, valueAsNumber, and valueAsString. I use valueAsNumber in the onChange event in an attempt to trigger the onInvalid event, but the breakpoint in _elevationInvalid is never hit even when valueAsNumber returns NaN.
Any guidance you could provide on how to properly use this event would be great!
The text was updated successfully, but these errors were encountered: