New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy object in nested array #425
Comments
Hello, since you're using Formsnap, I'm not exactly sure how to handle this. You should have |
Hello, thanks for the asnwer, I asked the same question in the formsnap discord, no answer yet. But I do have I found that if I set the dateProxy manually like this: Any ideas how to do that? Thank you. |
You could make a reactive statement that creates the proxies, and use them in the each loop. |
Would you mind showing me a quick example of how to do that? Thank you so much ♥ |
It's not a quick example (nested data, array in component, proxy), but here you are: https://www.sveltelab.dev/ifdh4vfvtdp38rl?files=.%2Fsrc%2Froutes%2F%2Bpage.svelte%2C.%2Fsrc%2Froutes%2FDateInput.svelte%2C.%2Fsrc%2Froutes%2F%2Bpage.server.ts |
Thank you so much, works great, haven't thought about using the index as prop for a dateProxy component. |
Description
Hello, I have a form with
<input type="date">
, I'm using a dateProxy to convert it to the right type, that's working great. The issue I'm having is I have this zod object:This Zod object is an array, because I have an Add button for creating additional rows for user to submit.
The issue is I don't know how to reference inputs that are in the array in the proxy function.
Here is the loop I'm using to display the array inputs.
I tried creating this dateProxy, but I'm not quite sure how to get it working. Would be glad for some help, thank you :)
const workDoneDateProxy = dateProxy(form, 'workDone.date', { format: 'date', empty: 'null' });
The text was updated successfully, but these errors were encountered: