Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How to receive array of object in Sveltekit Action?

$
0
0

I'm new to Sveltekit,

I have a form with the input names set like so:

input 1: config[0][name]input 2: config[0][type]input 3: config[1][name]input 4: config[2][type]

here in the Sveltekit Action I tried to console.log it:

'config[0][name]': '','config[0][type]': '','config[1][name]': '','config[1][type]': '',

so because of that I can only access the data like this formData['config[0][name]']

here's my code:

 const create: Action = async ({request})=> {    const formData = Object.fromEntries(await request.formData());    console.log("data", formData);    }

how can I receive it as an array that I can access normally like this?

formData.config[0].name

Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>