DigitalState / Services

The DigitalState Services Microservice
MIT License
13 stars 5 forks source link

Error 500 on Services/Scenarios/{scenario.uuid}/forms when multi-values field is present #78

Open Rvaucher opened 5 years ago

Rvaucher commented 5 years ago

When trying to fetch (GET {{services}}/scenarios/{scenarion.uuid}/forms) the start-up form on a scenario, if a multi-value selection component is in it component.txt, its default value is an empty array.

Due to this, while trying to fetch the form, I obtained this response response.txt

If we switch back the default value to an empty string, we can get the form back.

StephenOTT commented 5 years ago

Thanks for reporting. Great find

devcitopia-zz commented 5 years ago

This issue blocks us on creating forms even basic ones. Can you confirm that this issue will be fixed on the next release (scheduled in mid July AFAIK) ?

Thanks for your confirmation.

StephenOTT commented 5 years ago

Yes we will look to get this adjusted as part of that release

dcoevoet51 commented 5 years ago

Hello,

Here's an example of an error when I want to access a scenario's form with an multivalue upload component.

form content:

{
    "components": [{
        "label": "Upload",
        "mask": false,
        "tableView": true,
        "alwaysEnabled": false,
        "type": "file",
        "input": true,
        "key": "upload",
        "defaultValue": [],
        "validate": {
            "customMessage": "",
            "json": ""
        },
        "conditional": {
            "show": "",
            "when": "",
            "json": ""
        },
        "storage": "base64",
        "dir": "",
        "fileNameTemplate": "",
        "webcam": false,
        "fileTypes": [{
            "label": "",
            "value": ""
        }],
        "encrypted": false,
        "properties": [],
        "customConditional": "",
        "logic": [],
        "reorder": false,
        "url": "",
        "options": "",
        "webcamSize": ""
    }, {
        "allowCalculateOverride": false,
        "autofocus": false,
        "calculateValue": "",
        "clearOnHide": true,
        "clearOnRefresh": false,
        "conditional": {
            "eq": "",
            "when": null,
            "show": null
        },
        "customClass": "",
        "customDefaultValue": "",
        "dataGridLabel": false,
        "dbIndex": false,
        "defaultValue": "",
        "description": "",
        "disabled": false,
        "errorLabel": "",
        "hidden": true,
        "hideLabel": false,
        "id": "els02no0",
        "input": true,
        "inputFormat": "plain",
        "inputMask": "",
        "inputType": "text",
        "key": "jsonIdentityRequested",
        "label": "Champs Technique",
        "labelMargin": 3,
        "labelPosition": "top",
        "labelWidth": 30,
        "mask": false,
        "multiple": false,
        "persistent": true,
        "placeholder": "",
        "prefix": "",
        "properties": [],
        "protected": false,
        "refreshOn": "",
        "showCharCount": false,
        "showWordCount": false,
        "suffix": "",
        "tabindex": "",
        "tableView": true,
        "tags": [],
        "tooltip": "",
        "type": "textfield",
        "unique": false,
        "validate": {
            "custom": "",
            "customPrivate": false,
            "maxLength": "",
            "maxWords": "",
            "minLength": "",
            "minWords": "",
            "pattern": "",
            "required": false
        },
        "validateOn": "change",
        "widget": {
            "saveAs": "text",
            "dateFormat": "yyyy-MM-dd hh:mm a",
            "format": "yyyy-MM-dd hh:mm a",
            "type": ""
        }
    }, {
        "allowCalculateOverride": false,
        "autofocus": false,
        "calculateValue": "",
        "clearOnHide": true,
        "clearOnRefresh": false,
        "conditional": {
            "eq": "",
            "when": null,
            "show": null
        },
        "customClass": "",
        "customDefaultValue": "",
        "dataGridLabel": false,
        "dbIndex": false,
        "defaultValue": "",
        "description": "",
        "disabled": false,
        "errorLabel": "",
        "hidden": true,
        "hideLabel": false,
        "id": "els02no1",
        "input": true,
        "inputFormat": "plain",
        "inputMask": "",
        "inputType": "text",
        "key": "canalRequest",
        "label": "Champs Technique",
        "labelMargin": 3,
        "labelPosition": "top",
        "labelWidth": 30,
        "mask": false,
        "multiple": false,
        "persistent": true,
        "placeholder": "",
        "prefix": "",
        "properties": [],
        "protected": false,
        "refreshOn": "",
        "showCharCount": false,
        "showWordCount": false,
        "suffix": "",
        "tabindex": "",
        "tableView": true,
        "tags": [],
        "tooltip": "",
        "type": "textfield",
        "unique": false,
        "validate": {
            "custom": "",
            "customPrivate": false,
            "maxLength": "",
            "maxWords": "",
            "minLength": "",
            "minWords": "",
            "pattern": "",
            "required": false
        },
        "validateOn": "change",
        "widget": {
            "saveAs": "text",
            "dateFormat": "yyyy-MM-dd hh:mm a",
            "format": "yyyy-MM-dd hh:mm a",
            "type": ""
        }
    }, {
        "allowCalculateOverride": false,
        "autofocus": false,
        "calculateValue": "",
        "clearOnHide": true,
        "clearOnRefresh": false,
        "conditional": {
            "eq": "",
            "when": null,
            "show": null
        },
        "customClass": "",
        "customDefaultValue": "",
        "dataGridLabel": false,
        "dbIndex": false,
        "defaultValue": "89bad8e2-58ea-4fb4-9cf8-c5bd94400ba0",
        "description": "",
        "disabled": false,
        "errorLabel": "",
        "hidden": true,
        "hideLabel": false,
        "id": "els02no2",
        "input": true,
        "inputFormat": "plain",
        "inputMask": "",
        "inputType": "text",
        "key": "tenantId",
        "label": "Champs Technique",
        "labelMargin": 3,
        "labelPosition": "top",
        "labelWidth": 30,
        "mask": false,
        "multiple": false,
        "persistent": true,
        "placeholder": "",
        "prefix": "",
        "properties": [],
        "protected": false,
        "refreshOn": "",
        "showCharCount": false,
        "showWordCount": false,
        "suffix": "",
        "tabindex": "",
        "tableView": true,
        "tags": [],
        "tooltip": "",
        "type": "textfield",
        "unique": false,
        "validate": {
            "custom": "",
            "customPrivate": false,
            "maxLength": "",
            "maxWords": "",
            "minLength": "",
            "minWords": "",
            "pattern": "",
            "required": false
        },
        "validateOn": "change",
        "widget": {
            "saveAs": "text",
            "dateFormat": "yyyy-MM-dd hh:mm a",
            "format": "yyyy-MM-dd hh:mm a",
            "type": ""
        }
    }]
}

Error returned when I want to show the scenario which this form is linked: Argument 1 passed to Ds\Component\Resolver\Collection\ResolverCollection::resolve() must be of the type string, array given, called in /srv/api/vendor/digitalstate/core/src/Form/Service/FormService.php on line 203