mercredi 3 novembre 2021

Formstack API - Field with multiple checkbox values as array

I create new submission for the specified form. I read documentation on https://developers.formstack.com/reference/form-id-submission-post I tested a lot of methods but nothing work. Only 'string' works fine (one value). I don't know where is error in my array.

// one value as string
'body' => json_encode([
    // x - is a field id
    'field_x' => 'option-1',
]),

// solution 1
'body' => json_encode([
    // x - is a field id
    'field_x' => [
        '1' => 'option-1',
        '2' => 'option-2'
    ],
]),

// solution 2
'body' => json_encode([
    // x - is a field id
    'field_x' => [
        'option-1',
        'option-2'
    ],
]),

// solution 3
'body' => json_encode([
    // x - is a field id
    'field_x' => [
        1 => 'option-1',
        2 => 'option-2'
    ],
]),



Aucun commentaire:

Enregistrer un commentaire