Problem/Motivation

Currently the State field is shown, even if there is only one option available. This could be confusing for people just getting started using Entity Registration, who may be using a simple workflow with only a single state.

Proposed resolution

Make the widget a value unless there are more than one states available.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mandclu created an issue. See original summary.

mandclu’s picture

Assigned: mandclu » Unassigned
Status: Active » Needs review
john.oltman’s picture

Status: Needs review » Needs work

Makes sense, thanks @mandclu! One concern is existing installs that rely on having the State field displayed even if it can't be changed, especially when an existing registration is being edited by an admin (uses the same RegisterForm as a new registration). I also think when hiding the field on an existing registration, it should set the value using the value of the registration state and not the one state in the states array, otherwise the state could unwittingly change without the admin knowing.

To address existing installs, an idea is add a field to the Workflow settings at /admin/config/workflow/workflows/manage/registration, it would be labelled "Single State Form Handling" with help text "Indicate how the registration state field should be handled when only one state is configured to be shown on the registration form" and possible values "Hide the State field" and "Show the State field", with "hide" being the default. We would then have a hook_update_nn set the value to "show" for existing sites and workflows. This way existing installs experience no change, and new sites hide it - we can mention in the release notes so existing sites can edit the workflows if they want the new way of doing things.

We'll also eventually need some tests.
Would like your thoughts on my ideas above, setting to needs work while we work through this.

john.oltman’s picture

Assigned: Unassigned » john.oltman

Going to proceed per my previous comment since no push back.

john.oltman’s picture

Better idea is to add the show/hide setting to the form field widget, so each form display can be configured differently as needed.

john.oltman changed the visibility of the branch 3473817-hide-state-field-3.1 to hidden.

  • john.oltman committed f10662a1 on 3.1.x
    Issue #3473817 by john.oltman, mandclu: Hide State field if only one...

  • john.oltman committed 51881389 on 3.3.x
    Issue #3473817 by john.oltman, mandclu: Hide State field if only one...
john.oltman’s picture

Assigned: john.oltman » Unassigned
Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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