Using a webform element of type Select other, with the Other option is selected and the dependent field below (one for specifying the other value) being left blank, when going to another step of the form and then coming back, the dependent field has "_other_" as its value.

Comments

mmaciusowicz created an issue. See original summary.

mmaciusowicz-rr’s picture

Status: Needs review » Needs work
jrockowitz’s picture

I can't replicate the issue because the empty 'Other' text field is triggering validation. See below

I have also attached my test form.

Can you please provide the steps required to replicate the issue with a "simple" exported form that duplicates the issue.

BTW, I think the issue/bug is that the server-side validation handler for the select other element is not being triggered on your form.

jrockowitz’s picture

Status: Needs work » Postponed (maintainer needs more info)

Are you able to reproduce the problem using https://simplytest.me/project/drupal/8.2.x?add[]=webform?

CatherineOmega’s picture

Okay, I can't reproduce "_test_", but I can get it to dump the field object into the "other" textfield, which I THINK is the same issue. Maybe.

Here's how to reproduce:

1. On simplytest, create a new webform.
2. Populate it with the attached YAML file.
3. View the form.
4. Fill a value for "other" at the bottom of the first page.
5. Click 'Next Page'.
6. Check "Yes".
7. See the "other" field full of this: "webform_checkboxes_other, Select the testtest program which applicant 2 participated in, Array, test--applicant_2_testtest_program, applicant_2_testtest_program, additional_applicants_disclaimer, , 2, 1, test, , , 0.001, before, after, edit-applicant-2-testtest-program"

Now, that's an "or other" field inside a conditional field. I CAN get it to do the same thing, overwriting the stored value, in one on the front page, but it seems to involve a lot of back and forth and saving drafts and going to other pages and back in, so I haven't been able to reproduce yet.

CatherineOmega’s picture

"Wow, your form's kind of big, Catherine," you might say. And yes, guess what it did to my php log?

[01-Feb-2017 17:05:10 America/Vancouver] Uncaught PHP Exception Drupal\Core\Entity\EntityStorageException: "SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'value' at row 74: INSERT INTO {webform_submission_data} (webform_id, sid, name, property, delta, value) VALUES (

And 400 lines of values later:

" at /Users/catherine/repos/mitacs-portal-d8/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php line 770
jrockowitz’s picture

I have isolated at least one error/issue...

The below elements...

wizard_page_1:
  '#type': wizard_page
  '#title': wizard_page_1
  checkboxes_other_1:
    '#type': checkboxes_other
    '#title': checkboxes_other_1
    '#options':
      one: One
      two: Two
      three: Three
    '#default_value':
      - 'Four'
wizard_page_2:
  '#type': wizard_page
  '#title': wizard_page_2
  checkboxes_other_2:
    '#type': checkboxes_other
    '#title': checkboxes_other_2
    '#options':
      one: One
      two: Two
      three: Three
    '#default_value':
      - ''

...throws...

Notice: Array to string conversion in Drupal\webform\Element\WebformOtherBase::valueCallback() (line 148 of modules/sandbox/webform/src/Element/WebformOtherBase.php).

I will look into this problem.

jrockowitz’s picture

Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Needs work

  • jrockowitz committed 31197e1 on 2847115-other-element
    Issue #2847115 by jrockowitz, CatherineOmega: "Select other" field type...
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new8.58 KB
jrockowitz’s picture

I pinpointed the issue to validation problems with hidden elements containing empty other values.

Status: Needs review » Needs work

The last submitted patch, 10: select_other_field-2847115-10.patch, failed testing.

  • jrockowitz committed 6840787 on 2847115-other-element
    Issue #2847115 by jrockowitz, CatherineOmega: "Select other" field type...
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new8.66 KB

Status: Needs review » Needs work

The last submitted patch, 14: select_other_field-2847115-14.patch, failed testing.

  • jrockowitz committed 00d9026 on 2847115-other-element
    Issue #2847115 by jrockowitz, CatherineOmega: "Select other" field type...
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new9.53 KB

Status: Needs review » Needs work

The last submitted patch, 17: select_other_field-2847115-16.patch, failed testing.

  • jrockowitz committed 540f61d on 2847115-other-element
    Issue #2847115 by jrockowitz, CatherineOmega: "Select other" field type...
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new9.54 KB

  • jrockowitz committed e1d4195 on 8.x-5.x
    Issue #2847115 by jrockowitz, CatherineOmega: "Select other" field type...
jrockowitz’s picture

Status: Needs review » Fixed

Since all the test are no passing, I committed the patch.

Please checkout or download the latest dev release to review.

Status: Fixed » Closed (fixed)

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