Problem/Motivation

When using the Select 2 boxes (Multiple values) widget on a form (in my case, node form) and you add/edit values to the field, if the form server side validation fails then the new values are not saved on the field.

Steps to reproduce

One simple way to reproduce is:
1. Create a dummy Content Type
2. Add a entity reference field to a taxonomy
3. Set the widget to "Select 2 boxes (Multiple values)"
4. Add a list string field or any field that can be displayed as radios, with at least 2 options and make it required
5. Set the widget to radios
6. Create a new node of the dummy Content Type
7. Do not select anything from the radios field (we want the validation to fail)
8. Add at least one value to the select 2 boxes field
9. Save the form and after the validation fails, you can see that the select 2 boxes field is empty, instead of containing the value that we set previously

Proposed resolution

Most probably there's a gap in the code, so debugging would be a good start.

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

CommentFileSizeAuthor
#2 form-validation-fix-3228646-2.patch629 bytesu_tiwari

Comments

bbu23 created an issue. See original summary.

u_tiwari’s picture

StatusFileSize
new629 bytes

Here is a fix.

  • matsbla committed 76464fb on 8.x-1.x authored by u_tiwari
    Issue #3228646 by u_tiwari: New values get lost during form validation...
matsbla’s picture

Status: Active » Fixed

The patch solves the issue, great, thanks!

bbu23’s picture

Status: Fixed » Needs work

Thank you for the patch. I don't know why I didn't see it when you posted it.
For some reason, it still doesn't work for me. The values still disappear from the form if the validation fails. Is it just me or..? Can you please tell me if the version matters? I applied the patch on alpha3, I see that the latest release is alpha8. Thanks!

matsbla’s picture

Status: Needs work » Fixed

Use last dev version

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.