Problem/Motivation

Playing around with the ui and a few composite elements, i noticed that the options dropdown next in the third column, was different depending on which element was listed. After further review of this and looking at the logic for the form, I found that this list was derived dynamically based upon the element's id.

This brought up a few hidden features/issues. Ultimately, the biggest one being that a user can add additional options to the list, but the available values are completely arbitrary, unless you understand how the list is build.

Proposed resolution

Additional information should be added to either the Webforms Options list, or to the element configuration pages in order to indicate how this functionality works. As an alternative, an admin could be given an interface to define these options themselves, which could also make/allow the admin to add options that don't meet the required prefix. A developer is able to add/alter this list by overriding getCompositeElementOptions() in their WebformElement definition.

Screenshot

Comments

richgerdes created an issue. See original summary.

richgerdes’s picture

Title: {Your title should be descriptive and concise} » Adding Alternative options for a option is not intuitive.
jrockowitz’s picture

Issue summary: View changes
StatusFileSize
new145.27 KB
jrockowitz’s picture

Building a UI where "an admin could be given an interface to define these options themselves" seems like a lot of work considering admins and developers can just create a custom composite element.

I like adding "additional information should be added to either the Webforms Options list" (/admin/structure/webform/config/options/manage) where we add a column called 'User By' and also display a message when editing the options that says...

The State codes options is used by the Address:State composite element.

The Webform Options that are being dynamically used by Composite elements are...

  • country_codes => Address and Contact
  • country_name => Address and Contact
  • state_province_codes => Address and Contact
  • state_province_names => Address and Contact
  • state_codes => Address and Contact
  • state_names => Address and Contact
  • phone_types => Telephone Advanced
  • titles => Name

We also need to see what happens when all the defaults options for a Composite element are deleted. Is there an error or does it default to a plain text field?

jrockowitz’s picture

Assigned: Unassigned » jrockowitz

  • jrockowitz committed eafb457 on 2937109-composite-options
    Issue #2937109: Adding Alternative options for a option is not intuitive
    

  • jrockowitz committed c118236 on 2937109-composite-options
    Issue #2937109: Adding Alternative options for a option is not intuitive
    

  • jrockowitz committed dcd7ef3 on 2937109-composite-options
    Issue #2937109: Adding Alternative options for a option is not intuitive...

  • jrockowitz committed d516193 on 2937109-composite-options
    Issue #2937109: Adding Alternative options for a option is not intuitive...

  • jrockowitz committed 6a2bbf6 on 2937109-composite-options
    Issue #2937109: Adding Alternative options for a option is not intuitive...
jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new27.89 KB

  • jrockowitz committed 4bd99f7 on 8.x-5.x
    Issue #2937109 by jrockowitz: Adding Alternative options for a option is...

  • jrockowitz committed 3f12a3d on 8.x-5.x
    Issue #2937109 by jrockowitz: Adding Alternative options for a option is...
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

Status: Fixed » Closed (fixed)

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