Sending an Array of Objects to a Database Column using Server Connect Form

Hello everyone,

I am currently working on a project where I need to send an array of objects as JSON to a database column using a Server Connect form in Wappler. Despite following the documentation and reading some posts, I’ve been unable to get it to work.

Here’s what I’ve done so far:

  1. Created a form with input fields to collect the necessary data.
  2. Set up a datastore using App Connect to collect the data with key-value property from the form fields.
  3. Set up a dynamic event for the form submission to trigger a Server Connect action.

I need to have the correct input to send the JSON text to the database.

Could anyone provide some guidance or examples on how to properly send an array of objects to a database row using a Server Connect form?

Any help would be greatly appreciated!

Thank you.

Hey @salvuccicarlos,

Please:

  1. paste your form code here in order to check it.
  2. open your dev tools, fill normally with data your form, submit it and:
    a) select your submit serveraction and share a screenshot of your payload

    b) check if you get any errors in your console

I’ve checked that. And the array is not being sent. I’ve tried inserting the value dynamically to an input but it shows [Object object]. I need to send the JSON with key-value format.

ok.

So, you want to pass the datastore data in your form?
You can add a hidden input in your form and pass the datastore in there

<input id="orderArray" name="orderArray" type="hidden" class="form-control" dmx-bind:value="(orderData.data).stringify()">

*In this example , orderData is the id of the datastore

Still not working, stringify is not inside arrray options

My code:
<input id="inp_contacto" name="contacto" class="form-control" readonly="true" dmx-bind:value="(orderData.data).stringify()">

This is my input (not hidden)

These are the array transformation options

Are you sure your dataStore id is “orderData”? Or you just pasted my example code and forgot to change it?

Also, please check if the dataStore has any data…

  • Console-> dmx.app.data and search for the name of the datastore
    or
  • Application → Storage . local or session (depends on how is defined your datastore component
1 Like

Try this: How to convert a DataStore to a String? Flow is having an unexpected behavior

1 Like