I can't limit value ????????
event on Keydown, onKeyup .... I not found.
example : min : 5 or Max: 10000
Use isAllowed prop to validate input. Something like
<NumberFormat isAllowed={(values) => {
const {floatValue} = values;
return floatValue >= 5 && floatValue <= 10000;
}}/>
thanks you very so much!
If i want to do the max limit, ho w can i do that?
return floatValue <= 10000;
}}/>
The above example is not working as i cant make empty input field or remain blank an input field, there is always one number is present in the input field.
Same issue here as mglrahul, how did this get resolved?
<NumberFormat isAllowed={(values) => {
const { formattedValue, floatValue } = values;
return formattedValue === "" || floatValue <= 10000;
}}/>
The solution provided didn't work for me, at least when I implemented them min value. I set a minimum value of 5 and the input would block me from inserting any value starting with 1, 2, 3 or 4. Even when my intention was inserting 10 or 12, I couldn't, because the first character is 1, and 1 is lower than 5. Here's my code:
isAllowed={values => {
const {formattedValue, floatValue} = values
return formattedValue === '' || (floatValue <= 15 && floatValue >= 5)
}}
Has anyone gone through this and found a solution?
The solution provided didn't work for me, at least when I implemented them
minvalue. I set a minimum value of 5 and the input would block me from inserting any value starting with 1, 2, 3 or 4. Even when my intention was inserting10or12, I couldn't, because the first character is1, and1is lower than5. Here's my code:isAllowed={values => { const {formattedValue, floatValue} = values return formattedValue === '' || (floatValue <= 15 && floatValue >= 5) }}Has anyone gone through this and found a solution?
this works for me:
isAllowed={values => {
const { formattedValue, floatValue } = values
if (floatValue == null) {
return formattedValue === ''
} else {
return (floatValue <= 15 && floatValue >= 5)
}
}}
Most helpful comment