some additional fixes for the numeric range field (#1464)
Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
parent
23e147793a
commit
1495b7dac8
|
@ -266,8 +266,8 @@ export default function CustomForm({
|
|||
errors[propertyKey].addError('must have valid Minimum and Maximum');
|
||||
}
|
||||
if (
|
||||
!formDataToCheck[propertyKey].min.toString().match(matchNumberRegex) ||
|
||||
!formDataToCheck[propertyKey].max.toString().match(matchNumberRegex)
|
||||
!formDataToCheck[propertyKey].min?.toString().match(matchNumberRegex) ||
|
||||
!formDataToCheck[propertyKey].max?.toString().match(matchNumberRegex)
|
||||
) {
|
||||
errors[propertyKey].addError('must have valid numbers');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ export const doNothing = () => {
|
|||
return undefined;
|
||||
};
|
||||
|
||||
export const matchNumberRegex = /^[0-9,.]*$/;
|
||||
export const matchNumberRegex = /^[0-9,.-]*$/;
|
||||
|
||||
// https://www.30secondsofcode.org/js/s/slugify
|
||||
export const slugifyString = (str: string) => {
|
||||
|
|
|
@ -166,6 +166,7 @@ export default function NumericRangeField({
|
|||
setMinValue(event.target.value);
|
||||
}}
|
||||
invalid={commonAttributes.invalid}
|
||||
invalidText={minHelperText}
|
||||
helperText={minHelperText}
|
||||
autofocus={autofocus}
|
||||
/>
|
||||
|
@ -181,6 +182,7 @@ export default function NumericRangeField({
|
|||
setMaxValue(event.target.value);
|
||||
}}
|
||||
invalid={commonAttributes.invalid}
|
||||
invalidText={maxHelperText}
|
||||
helperText={maxHelperText}
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue