using id as form name for number and string component

This removes errors saying that quotes within element name are not allowed.
This commit is contained in:
Mose Müller
2024-04-29 15:26:13 +02:00
parent 6eaf1a03d1
commit a214d6d85a
2 changed files with 3 additions and 5 deletions

View File

@ -328,9 +328,7 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
useEffect(() => {
// Set the cursor position after the component re-renders
const inputElement = document.getElementsByName(
fullAccessPath
)[0] as HTMLInputElement;
const inputElement = document.getElementsByName(id)[0] as HTMLInputElement;
if (inputElement && cursorPosition !== null) {
inputElement.setSelectionRange(cursorPosition, cursorPosition);
}
@ -353,7 +351,7 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
value={inputString}
disabled={readOnly}
onChange={() => {}}
name={fullAccessPath}
name={id}
onKeyDown={handleKeyDown}
onBlur={handleBlur}
className={isInstantUpdate && !readOnly ? 'instantUpdate' : ''}

View File

@ -90,7 +90,7 @@ export const StringComponent = React.memo((props: StringComponentProps) => {
</InputGroup.Text>
<Form.Control
type="text"
name={fullAccessPath}
name={id}
value={inputString}
disabled={readOnly}
onChange={handleChange}