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 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 62.91%. Comparing base (1fde0d9) to head (579b887).

Files with missing lines Patch % Lines
...ugins/importFromJSONAction/ImportFromJSONAction.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7986      +/-   ##
==========================================
+ Coverage   57.58%   62.91%   +5.33%     
==========================================
  Files         678      436     -242     
  Lines       27426    13642   -13784     
  Branches     2692        0    -2692     
==========================================
- Hits        15792     8583    -7209     
+ Misses      11291     5059    -6232     
+ Partials      343        0     -343     
Flag Coverage Δ
e2e-ci 62.82% <0.00%> (+<0.01%) ⬆️
e2e-full 23.65% <0.00%> (-18.30%) ⬇️
unit ?
Files with missing lines Coverage Δ
...ugins/importFromJSONAction/ImportFromJSONAction.js 11.33% <0.00%> (-64.67%) ⬇️

... and 370 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 1fde0d9...579b887. 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
@johnriedel johnriedel force-pushed the 7985-show-errors-with-form-controls branch from 5530815 to 579b887 Compare January 19, 2025 04:11
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