You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way that I can modify the value of the initialValues when using the helper components?
I want to change 3 inputs when one input changes because I want to get from the server the values.
const initialValues = {
identification: "", // --> When input, i want to change firstname, lastname, and lastname2 with values from the server
firstName: "",
lastName1: "",
lastName2: ""
};
I'm unable to call a custom function and change the values directly because the Form don;t detect the change and because of that the form says the value is required.
The text was updated successfully, but these errors were encountered:
@georgeemrcreateForm exposes a Svelte writable store named form. In your case, you can use a reactive block to fetch the data from the server when the form changes, and use .update() from the store to update your values.
E.g.,
$: {// fetch data from APIform.update(data=>({ ...data,firstName: API_RESULT_FIRSTNAME,lastName: API_RESULT_LASTNAME,lastName1: API_RESULT_LASTNAME1}))}
Edit: specify which Svelte writable store is exposed
Is there a way that I can modify the value of the initialValues when using the helper components?
I want to change 3 inputs when one input changes because I want to get from the server the values.
const initialValues = {
identification: "", // --> When input, i want to change firstname, lastname, and lastname2 with values from the server
firstName: "",
lastName1: "",
lastName2: ""
};
I'm unable to call a custom function and change the values directly because the Form don;t detect the change and because of that the form says the value is required.
The text was updated successfully, but these errors were encountered: