Skip to content

Commit

Permalink
Merge pull request #1247 from NASA-IMPACT/1246-minor-enhancement-docu…
Browse files Browse the repository at this point in the history
…ment-type-pattern-form-require-document-type-or-show-appropriate-error

Minor Enhancement: Document Type Pattern Form – Require Document Type or Show Appropriate Error
  • Loading branch information
CarsonDavis authored Mar 7, 2025
2 parents a173a80 + baedb88 commit 3632801
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,9 @@ For each PR made, an entry should be added to this changelog. It should contain
- Changes:
- Added `escapeHtml` function in the `delta_url_list.js` file to handle special character escaping correctly.
- Called this function while retrieving the titles in `getGeneratedTitleColumn()` and `getCuratedGeneratedTitleColumn()` functions.

- 1246-minor-enhancement-document-type-pattern-form-require-document-type-or-show-appropriate-error
- Description: In the Document Type Pattern Form, if the user does not select a Document Type while filling out the form, an appropriate error message is displayed.
- Changes:
- Added a JavaScript validation check on form submission to ensure the document type (stored in a hidden input) is not empty.
- Display an error message and prevent form submission if the field is empty.
6 changes: 6 additions & 0 deletions sde_indexing_helper/static/js/delta_url_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,12 @@ $("#document_type_pattern_form").on("submit", function (e) {
inputs[field.name] = field.value;
});

// Validate that the document_type_pattern field is not empty
if (!inputs.document_type_pattern) {
toastr.error("Please select a Document Type");
return; // Prevent form submission
}

postDocumentTypePatterns(
inputs.match_pattern,
inputs.match_pattern_type,
Expand Down

0 comments on commit 3632801

Please sign in to comment.