I am trying to insert data into three tables from one form, two of which are working fine, the 3rd, however I can not get the data to format correctly, even after scouring these forums and trying every combination of linking/formatting, etc., regardless of what I try = /.
My form is made up of three parts: initial section with a few text inputs; then a form repeat below it with two select inputs plus an add button; then a sub/nested(?) form within that first repeat containing two more inputs and another add / delete button. Upon submit I currently have a server action that has a single db insert containing the text fields from the first section, then below it a Repeat which contains a second DB insert for which the expression references the array in POST array and references the unique ID from the single db insert, then a second Repeat within the first one doing essentially the same thing, referencing the second POST array and grabbing the unique ID from its respective index from the first Repeat.
Like I said, the data from the first repeat form/server action inserts just as expected with each value within its correct column, and referencing the correct info the main table, but from the second repeat the data comes in as an array that I can not reformat so that the data goes to its intended place. The value it is returning looks like this:
{“percentTotal”:"",“parentIndex”:[“0”,“1”],“user”:[“1”,“3”],“percentage”:[".70",".60"]},
for which I am trying to convert to a normal row/column format, but cant figure out how to either split these apart correctly, or send them to the server action in a different format altogether.
The thing that I think is causing the main issue is that the sub-repeat action is running through the entire array of all of the sub repeats every time it runs the first one instead of just the ones that correspond with the first repeat, but I cant figure out how to control this.
I feel like I am making the solution more complicated than it needs to be, however, I am not having any luck figuring out what that needed solution is =/. If screen shots would be helpful, or more information is needed let me know and I will include, but I think for someone with even a little bit of experience the this is probably enough info to point out where I may be stuck.