umbraco / Umbraco.Forms.Issues

Public issue tracker for Umbraco Forms
29 stars 0 forks source link

Conditional fields not saving input data #1173

Closed neeqit closed 7 months ago

neeqit commented 7 months ago

Conditional fields not saving input data.

Reproduction

  1. Create form that contains: 1.1. Multiple choice field with 3 options. 1.2. 3 short answer fields, with condition to show if one of the options from Multiple choice field (1.1) is selected (If first option from Multiple choice is selected, then show first short answer field, if second option, then second short answer field, etc.) formSetup

  2. Embed this form on the page, and submit it choosing all 3 options and filling all 3 short answer fields, formSubmit

  3. Check form entries. There are no data for 3 short answer fields. formEntrie

Expected result

Data is saved

Actual result

Data is not saved

Version

Issue is reproducible on: Umbraco.Cms 13.1.1 with Umbraco.Forms 13.0.2 Umbraco.Cms 10.8.3 with Umbraco.Forms 10.5.2

AndyButland commented 7 months ago

I think you should be using a "contains" clause here rather than an "is" expression.

As currently the server-side check that is excluding saving these values is strictly correct - the value of "Choice" isn't "Text1", "Text2" or "Text3", rather it contains those values.

It's the client-side that appears to be wrong here, in that it shouldn't really be showing the text boxes unless only the single associated one of the checkboxes is selected.

Will have a look at that... but meantime if you amend to use "contains" it should work as you expect.

AndyButland commented 7 months ago

As of 13.1 we'll resolve this client-side issue, so, in this example, the "Test1" field would show if, and only if, the "Test1" choice is selected. If "Test1" and "Test2" are selected, it won't.