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

[Forms, ImportFromJSONAction plugin] display form error inside form #7986

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johnriedel
Copy link
Contributor

@johnriedel johnriedel commented Jan 15, 2025

Closes #7985

Describe your changes:

This feature adds an error message option for every form control created via the Forms API. Error message display is initiated via a form control's validate function. The function's second parameter is a function through which an error message may be passed. For example:

function validate(data, fail) { return fail("My error message."); }

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this a notable change that will require a special callout in the release notes? For example, will this break compatibility with existing APIs or projects that consume these plugins?

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

Testing Instructions

  1. In the action menu, click "Import From JSON"
  2. For the file input, select a non-JSON text file.
  3. Upon failed validation, the associated error message will appear in the form under the control.
    image

Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 57.27%. Comparing base (5be103e) to head (5530815).

Files with missing lines Patch % Lines
src/api/forms/components/FormRow.vue 25.00% 3 Missing ⚠️
...ugins/importFromJSONAction/ImportFromJSONAction.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7986      +/-   ##
==========================================
- Coverage   57.70%   57.27%   -0.43%     
==========================================
  Files         678      678              
  Lines       27428    27431       +3     
  Branches     2691     2691              
==========================================
- Hits        15826    15712     -114     
- Misses      11264    11378     +114     
- Partials      338      341       +3     
Flag Coverage Δ
e2e-ci 62.82% <0.00%> (ø)
e2e-full 23.65% <0.00%> (-18.36%) ⬇️
unit 49.33% <20.00%> (-0.19%) ⬇️
Files with missing lines Coverage Δ
...ugins/importFromJSONAction/ImportFromJSONAction.js 76.00% <0.00%> (ø)
src/api/forms/components/FormRow.vue 72.97% <25.00%> (-3.50%) ⬇️

... and 15 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5be103e...5530815. Read the comment docs.

@johnriedel johnriedel force-pushed the 7985-show-errors-with-form-controls branch from a104a57 to 5530815 Compare January 15, 2025 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error messages should appear with form controls
1 participant