verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
95 stars 72 forks source link

Form submission error when radio button's value is over a certain length #1956

Closed bliswebagency closed 3 months ago

bliswebagency commented 3 months ago

Describe the bug

We have a radio button field with the value set to a string that's 70 characters long.

When we try to save this form formie logs: [error][formie] Couldn’t save submission due to errors - {"myRadioButton":["Is your organisation a member? is invalid."]}.

If we change this radio button field's value to something short, say under 10 characters long, it works.

Steps to reproduce

  1. Create form with radio button and set the option values to strings 70 characters long
  2. Save the form and error is produced
  3. Update the form and change the option values to something shorter, eg 'Yes' and 'No'.
  4. Save the form and there is no error

Form settings

Craft CMS version

3.9.13

Plugin version

1.6.41

Multi-site?

No

Additional context

Additional context:

We upgraded to the latest version (at the time) from a previous beta and we're not sure if the fields may have somehow become corrupted, however if we reproduce or clone a form the same error still occurs on the copy.

Below is how the field settings (from the fields table) looks like in the database. When the long value is used it produces an error, but changing these to simply 'Yes' or 'No' has worked as a temporary workaround.

{
  "layout": "vertical",
  "options": [
    {
      "label": "Yes, my organisation is a ******************",
      "value": "Yes, my organisation is a ******************",
      "isDefault": false
    },
    {
      "label": "No, my organisation is ******************",
      "value": "No, my organisation is ******************",
      "isDefault": false
    }
  ],
  "columnWidth": 12,
  "limit": null,
  "limitType": "characters",
  "limitAmount": null,
  "matchField": null,
  "placeholder": null,
  "defaultValue": null,
  "prePopulate": null,
  "errorMessage": null,
  "labelPosition": "",
  "instructionsPosition": "",
  "cssClasses": null,
  "containerAttributes": [],
  "inputAttributes": [],
  "includeInEmail": true,
  "enableConditions": null,
  "conditions": "{\"showRule\":\"show\",\"conditionRule\":\"all\",\"conditions\":[]}",
  "enableContentEncryption": false,
  "visibility": "",
  "formId": ***********,
  "isNested": false
}
engram-design commented 3 months ago

It's a somewhat known issue, that's no longer an issue in Formie 3 for Craft 5. Refer to https://github.com/verbb/formie/issues/1648 and https://github.com/verbb/formie/issues/1722

For Formie 1 and 2 we have a plugin setting named enableLargeFieldStorage which you can set to true in your configuration that will change several fields to use text as their content column. Set that and re-save the form to opt-in to the larger column setting.

bliswebagency commented 3 months ago

Thank you for the quick response @engram-design

We will give this a try and see how it goes!