Hello everyone,
I am currently working on a Wix form (#form1) that collects shipping information such as first name (#input3), last name (#input2), email (#input1), company name (#input3), ship from (#addressInput3), ship to (#addressInput1), delivery option (#dropdown1), and details about the items being shipped such as quantity, weight, length, width, and depth of up to three items (#input4, #input5, #input6, #input7, #input8, #input10, #input11, #input12, #input13, #input14, #input15, #input16, #input17).
I have a database collection called "delivery-form" that includes fields for weight, quantity, email, lastName, firstName, companyName, deliveryType, depth, length, and width.
However, I am struggling with submitting the form data to the database in a format where the quantities, weight, length, width, and depth are all in the same column.
I would greatly appreciate any help or guidance on how to properly format the form data and submission button (#button1) to ensure the data is properly collected in the database. Thank you in advance for any assistance you can provide!
The data is not sending to my collection. I have tried recreating the form using a custom form but I’m still having no luck
The issues with having my quantity, length, width, weight and depth columns not in the same row is that my form allowa multiple entries as it’s a parcel delivery form, so I could potientially have 50+ columns
I wouldn't recommend this because by concatenating your data into one column, it will be more difficult to sort and query in the future. In addition you will have to store everything as a string separated by commas so to do any future calculations you would need to deal with this when you query.
However, if this is required for your use case all you have to do is define the column name in your collection and then on insert make sure to concatenate the data prior to the insert.
let newVal = val1 + "," + val2....etc etc. "my_field": newVal
See the link for the full code snippet on how to inset values to a collection
https://www.wix.com/velo/reference/wix-data/insert