Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn users on Multivalued input in the presence of single valued Webform Elements #182

Open
DiegoPino opened this issue Nov 22, 2024 · 2 comments
Assignees
Labels
Drupal 10 Gosh. Yes. The number X enhancement New feature or request Webform Elements Things with input to fill and interact with while ingesting metadata Webform Handler Webform Widgets Connecting Webforms and Entity Fields
Milestone

Comments

@DiegoPino
Copy link
Member

What?

Now that drupal actually fails on render arrays (or any array) that is "indexed" we need to tackle this old story. They/them/she/him brings an array of flowers, They/them/she/him has only use (and brain space) for a single flower -> json/webform analogy ...

Basically we need to parse the webform upfront. if the destination of (e.g) descripion (that holds 2 descriptions) is a single textarea, saving the value will remove anything else there but also fail rendering.Because webforms can not be modified on the fly, we can at least alert/avoid saving in that case (and avoid the error)

@DiegoPino DiegoPino self-assigned this Nov 22, 2024
@DiegoPino DiegoPino added this to the 1.5.0 milestone Nov 22, 2024
@DiegoPino DiegoPino added enhancement New feature or request Webform Widgets Connecting Webforms and Entity Fields Webform Elements Things with input to fill and interact with while ingesting metadata Webform Handler Drupal 10 Gosh. Yes. The number X labels Nov 22, 2024
@alliomeria
Copy link
Contributor

Hi @DiegoPino, the validation checks you're building out sound great. Following up after our live discussions about this earlier today to share a few different scenarios about what may be helpful for common use-cases:

  1. Going with your analogy, a user is using a webform to edit a digital object that has 2 values for 'description'. The webform is configured to limit the 'description' values to a single value.
  • Regardless of whether the user is attempting to edit the 'description' value(s) or a different element, the 'description' element itself displays as greyed out or otherwise visually marked (such as the red outline and asterisk currently noted when required webform elements are not filled out).
  • In addition to the visual marking, an error note by any impacted webform element that says something like "This webform element is not able to edit the data stored for this object. Please review your object data and webform element settings, and adjust either as needed."
  1. For file upload elements, present a 'bypass upload limit validation for existing files' option. Possibly make this bypass option available tied to a User Role Permission.

  2. If any of the digital object data to webform element validation checks do not pass (due to single value versus multiple value or compound element versus string/non-compound values), on the final webform step or when attempting to Save changes, display a brief note to the user listings all of the particular JSON keys that are not able to be edited by the webform for the currently selected digital object. Same recommendation note to "Please review your object data and webform element settings, and adjust either as needed."

@DiegoPino
Copy link
Member Author

@alliomeria thanks so much for the detailed workflow/description.
Ideal case is to give people visual feedback on the form itself, but wonder, if you would be Ok, if I go first (and I will do as you suggest, promise) with a simply "block" the form for use if data diverges, still giving users enough feedback?

reason is I don't want to delay this part too much. It is core and important we don't allow data to be lost/corrupted, but I fear end of the year + other pulls we have on the works (AMI, Facets) might make this take too much time.

Will work on this tonight and see how hard it is to tap with visual feedback (e.g give the form elements #access = false) when this happens.

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Drupal 10 Gosh. Yes. The number X enhancement New feature or request Webform Elements Things with input to fill and interact with while ingesting metadata Webform Handler Webform Widgets Connecting Webforms and Entity Fields
Projects
None yet
Development

No branches or pull requests

2 participants