Commit 27e36761 authored by Stefan Probst's avatar Stefan Probst
Browse files

fix: make form controls controlled components

parent 2d60ac94
......@@ -37,7 +37,7 @@ export function FormAutoSuggest<T>(
onBlur: input.onBlur,
onFocus: input.onFocus,
onInputChange: input.onChange,
defaultInputValue: meta.initial,
inputValue: input.value,
})}
{...getFormFieldValidationState(meta)}
/>
......
......@@ -22,7 +22,7 @@ export function FormCheckBox(props: FormCheckBoxProps): JSX.Element {
onBlur: input.onBlur,
onFocus: input.onFocus,
onChange: input.onChange,
defaultSelected: meta.initial,
isSelected: input.checked,
})}
{...getFormFieldValidationState(meta)}
/>
......
......@@ -22,7 +22,7 @@ export function FormCheckBoxGroup(props: FormCheckBoxGroupProps): JSX.Element {
onBlur: input.onBlur,
onFocus: input.onFocus,
onChange: input.onChange,
defaultValue: meta.initial,
value: input.value,
})}
{...getFormFieldValidationState(meta)}
/>
......
......@@ -28,7 +28,7 @@ export function FormComboBox<T>(props: FormComboBoxProps<T>): JSX.Element {
onBlur: input.onBlur,
onFocus: input.onFocus,
onSelectionChange: input.onChange,
defaultSelectedKey: meta.initial,
selectedKey: input.value,
})}
{...getFormFieldValidationState(meta)}
/>
......
......@@ -25,7 +25,7 @@ export function FormSelect<T>(props: FormSelectProps<T>): JSX.Element {
onBlur: input.onBlur,
onFocus: input.onFocus,
onSelectionChange: input.onChange,
defaultSelectedKey: meta.initial,
selectedKey: input.value,
})}
{...getFormFieldValidationState(meta)}
/>
......
......@@ -22,7 +22,7 @@ export function FormTextArea(props: FormTextAreaProps): JSX.Element {
onBlur: input.onBlur,
onFocus: input.onFocus,
onChange: input.onChange,
defaultValue: meta.initial,
value: input.value,
})}
{...getFormFieldValidationState(meta)}
/>
......
......@@ -24,7 +24,7 @@ export function FormTextField(props: FormTextFieldProps): JSX.Element {
onBlur: input.onBlur,
onFocus: input.onFocus,
onChange: input.onChange,
defaultValue: meta.initial,
value: input.value,
})}
{...getFormFieldValidationState(meta)}
/>
......
......@@ -83,13 +83,6 @@ function ContactForm() {
const subject = useQueryParam('subject', false)
const message = useQueryParam('message', false)
useEffect(() => {
// remove query params from url
if (router.isReady && Object.keys(router.query).length > 0) {
router.replace({ query: {} }, undefined, { shallow: true })
}
}, [router])
function onSubmit(formData: ContactFormData) {
// const recaptchaValue = recaptchaRef.current?.getValue()
// recaptchaRef.current?.reset()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment