mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-12 02:24:15 +00:00
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');
|
errors[propertyKey].addError('must have valid Minimum and Maximum');
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
!formDataToCheck[propertyKey].min.toString().match(matchNumberRegex) ||
|
!formDataToCheck[propertyKey].min?.toString().match(matchNumberRegex) ||
|
||||||
!formDataToCheck[propertyKey].max.toString().match(matchNumberRegex)
|
!formDataToCheck[propertyKey].max?.toString().match(matchNumberRegex)
|
||||||
) {
|
) {
|
||||||
errors[propertyKey].addError('must have valid numbers');
|
errors[propertyKey].addError('must have valid numbers');
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ export const doNothing = () => {
|
|||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const matchNumberRegex = /^[0-9,.]*$/;
|
export const matchNumberRegex = /^[0-9,.-]*$/;
|
||||||
|
|
||||||
// https://www.30secondsofcode.org/js/s/slugify
|
// https://www.30secondsofcode.org/js/s/slugify
|
||||||
export const slugifyString = (str: string) => {
|
export const slugifyString = (str: string) => {
|
||||||
|
@ -166,6 +166,7 @@ export default function NumericRangeField({
|
|||||||
setMinValue(event.target.value);
|
setMinValue(event.target.value);
|
||||||
}}
|
}}
|
||||||
invalid={commonAttributes.invalid}
|
invalid={commonAttributes.invalid}
|
||||||
|
invalidText={minHelperText}
|
||||||
helperText={minHelperText}
|
helperText={minHelperText}
|
||||||
autofocus={autofocus}
|
autofocus={autofocus}
|
||||||
/>
|
/>
|
||||||
@ -181,6 +182,7 @@ export default function NumericRangeField({
|
|||||||
setMaxValue(event.target.value);
|
setMaxValue(event.target.value);
|
||||||
}}
|
}}
|
||||||
invalid={commonAttributes.invalid}
|
invalid={commonAttributes.invalid}
|
||||||
|
invalidText={maxHelperText}
|
||||||
helperText={maxHelperText}
|
helperText={maxHelperText}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user