Editor 1.10.7 and multi Select - unexpected data structure passed from Editor

Editor 1.10.7 and multi Select - unexpected data structure passed from Editor

atcclearsatcclears Posts: 24Questions: 7Answers: 0
edited August 2015 in Editor

I have Editor successfully configured to have a SELECT field, and where that field allows the user to select multiple values from the list:

      { label: "Usage:", name: "usage_txt", attr: { multiple: "true", size: "4" }, type: "select",
        options: [
                 { label: "Create ", value: " Create " },
                 { label: "Read ", value: " Read " },
                 { label: "Update ", value: " Update " },
                 { label: "Delete ", value: " Delete " }
        ]
      },

The problem is the unexpected data structure being passed from Editor to the server-side program:

action:create
data[application_version]:2
data[dependent_data_entity]:S_ADDR_PER
data[sensitivity_txt]:
data[usage_txt][]: Create 
data[usage_txt][]: Read 
data[usage_txt][]: Update 
data[usage_txt][]: Delete 
data[gmt_dt]:
...

Is this expected behavior from Editor? The column is usage_txt and you can see that if I select all four rows then I get all four passed in this way to the server-side program.

This question has accepted answers - jump to:

Answers

  • atcclearsatcclears Posts: 24Questions: 7Answers: 0

    Correction, I meant to say DataTables 1.10.7 and Editor 1.4.2...

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Answer ✓

    Yes - the usage_txt is selecting multiple values and it is returning them as an array.

    Would you prefer them in a concatenated comma delimited string? There isn't an option for that at the moment, but it sounds like a useful addition.

    Allan

  • atcclearsatcclears Posts: 24Questions: 7Answers: 0

    I can adjust/accommodate in the server-side script, but yes a delimited string would be a useful addition. :)

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Answer ✓

    Another option would be to use the preSubmit event to loop over the data submitted and join() the data if it is an array.

    Allan

This discussion has been closed.