Pass a Javascript Array to a Server Connect - $_GET array can't output

I have some javascript code that produces an array of values that I want to add to my database. I created the array in the $_GET with the intention of sending the array via dmx.parse('insert_pl.load({array_of_times: my_array})). I was then going to grab the array in a repeat step to add each item to my database. The issue is that the $_GET.array_of_times doesn’t show anything to output and therefore I can’t get the individual array items for the insert.

image

I also did a quick test with POST and that doesn’t seem to be working either…

Wappler’s UI uses metadata to show the variables inside the repeat, so you’d have to add metadata for $_GET.array_of_times

Screenshot

Even if you didn’t add the metadata, the Repeat would still work if you typed the variable names directly in the code view of the expression builder

Sorry, I don’t understand what you mean. I saw in another post that you should be able to select the fields as Outputs and then use them…

From - Need help with Multiple UPDATE and INSERT Server Action Steps

If by metadata you mean the fields inside the array, I already have those…

image

@George , @patrick - I think there’s a bug. I added one item (pl_open_date_time) manually in the code and now they come up properly…

Also just a note - it would be great if there was a “select all” for output fields rather than having to select each item individually. :slight_smile:

Changing the output filter to exclude does this nothing selected will output all

1 Like

Ah - clever. Thanks.

1 Like

Not sure if what I am trying to do is exactly the same, but I have a repeat table row that displays my details per user and I want to sum all the totals of selected items.

I used the form with $post with success but when trying to get the same data using $get, it is not picked up by the server connect action I am running. Probably not making sense, but let’s try pictures:

This is my get array and variable(Just testing with 1 now):

Screenshot 2023-02-24 at 14.20.46

This is where I try to do the same as with a form post repeating through the array from the front end repeat:

This is where I try to select the variables/array using the Wappler UI for the serverconnect action:

The idea is to repeat through the records and sum all items selected on the page.

Did you change the form type from POST to GET?

1 Like

I am not using form, but only data from the repeat inside the form, so it did not occur to me to change the POST to GET since I need the post. I was triggering the server action on updated value.

Luckily I solved my problem in a completely different way, still getting the results I needed.

Glad you got it solved. Have a fab weekend.

1 Like