Removed submit button

This commit is contained in:
Tilen Komel
2024-09-06 09:33:13 +02:00
parent d10c010b9a
commit 5e72510bef
2 changed files with 17 additions and 2 deletions
@@ -120,8 +120,7 @@ export const Security = (): JSX.Element => {
<> <>
<DynamicForm<SecurityValidation> <DynamicForm<SecurityValidation>
onSubmit={onSubmit} onSubmit={onSubmit}
submitType="onSubmit" submitType="onChange"
hasSubmitButton={true}
defaultValues={{ defaultValues={{
...config.security, ...config.security,
...{ ...{
+16
View File
@@ -50,6 +50,21 @@ const Generator = React.forwardRef<HTMLInputElement, GeneratorProps>(
}, },
ref, ref,
) => { ) => {
const inputRef = React.useRef<HTMLInputElement>(null);
// Invokes onChange event on the input element when the value changes from the parent component
React.useEffect(() => {
if (!inputRef.current) return;
const setValue = Object.getOwnPropertyDescriptor(
HTMLInputElement.prototype,
"value",
)?.set;
if (!setValue) return;
inputRef.current.value = "";
setValue.call(inputRef.current, value);
inputRef.current.dispatchEvent(new Event("input", { bubbles: true }));
}, [value]);
return ( return (
<> <>
<Input <Input
@@ -60,6 +75,7 @@ const Generator = React.forwardRef<HTMLInputElement, GeneratorProps>(
onChange={inputChange} onChange={inputChange}
action={action} action={action}
disabled={disabled} disabled={disabled}
ref={inputRef}
/> />
<Select <Select
value={devicePSKBitCount?.toString()} value={devicePSKBitCount?.toString()}