Setting an element default value is confusing

Created on 25 June 2024, 4 months ago
Updated 27 June 2024, 4 months ago

Problem/Motivation

Setting a default value on an element does not work.

Steps to reproduce

  • Create a webform.
  • Add a textfield element.
  • Fill in a default value in the "advanced tab" when editing the element.
  • Click "Set default value" button.
  • The default has not been saved to the element.
  • The "Advanced" tab does not open.
  • The url gets a "#" appended. (js does not work? - no console errors)

Expected result

  • Advanced tab should open after clicking "Set default value", as it does when clicking "Clear default value".
  • The default value should be saved to the webform config.
  • Url should not change.

When adding a default value to the webform manually (through the source), the default value is being used while both viewing and editing the element.

πŸ› Bug report
Status

Closed: works as designed

Version

6.2

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium matthiasm11

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

  • Issue created by @matthiasm11
  • Status changed to Postponed: needs info 4 months ago
  • The "steps to reproduce" do not include the "Update default value" step, which is what I see when setting a value. Do you not see the following?

    After selecting "update default value" and saving the element, the default value works.

  • Status changed to Needs work 4 months ago
  • πŸ‡§πŸ‡ͺBelgium matthiasm11

    Thank you for clarifying!

    I misinterpreted the button "set default value" as a submit/save button for the value, since one can enter a value in the textfield above.
    Maybe we should make the textfield in my screenshot disabled? - It makes no sense to allow someone to edit it.

    It appears the "set default value" is only a link to another form, which contains the actual submit button from the screenshot in #2. And after clicking "update default value", it is also necessary to save the element itself with the blue save button at the bottom. So the submit button "update default value" isn't a save button, but a "go back to the form" button.

    UX-wise, it would be a lot cleaner if we remove the "set default value" button, let the user enter the default value in the textfield (with the green border in the screenshot above) and let them save it using the blue "save" button at the bottom in the advanced tab. No need to open another form. This way it works the same as all other fields in the advanced (and other) tabs. Even the "clear default value" can be removed, so users can empty it themselves? After all, there isn't a "clear wrapper css classes", "clear help title" and so on... either.

    What are your thoughts?

  • Status changed to Active 4 months ago
  • I agree the UX is not ideal. There is probably some history here in this issue queue as to why the situation is the way it is. It looks like #3260016: Default Element Value cannot easily be CLEARED once set β†’ is part of the story.

    This needs an issue summary update if it is going to be the issue that improves UX.

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    The 'Set default value' button opens an instance of the input based on the currently entered settings and validation rules. For more complex elements, including composites, we need to rerender the entire element.

    I am not sure we should make any changes to this behavior.

  • πŸ‡§πŸ‡ͺBelgium matthiasm11

    I see. Can we make the field disabled so it becomes less confusing?

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    I am hesitant to make any UI/UX changes, but the field could be disabled via a form alter hook.

  • Status changed to Closed: works as designed 4 months ago
  • πŸ‡§πŸ‡ͺBelgium matthiasm11

    Ok, no problem. Thank you both for the swift replies!

Production build 0.71.5 2024