-
Notifications
You must be signed in to change notification settings - Fork 41
fix: user defined Form Definition persists across the app #7571
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
Open
kwhuber
wants to merge
7
commits into
main
Choose a base branch
from
issue-5168
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+47
−13
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emenslin
approved these changes
Dec 1, 2025
Collaborator
emenslin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Go to App Resources
- Create a new Form Definition under Global Resources and copy one of the defaults (for example, "Vertpaleo")
- Name it something other than the name of the one you copied
- Switch to the XML editor and see that the "name=" value is of the name that you defined (not of the default Form Definition you copied)
Looks good, name is copied correctly!
12-01_12.02.mp4
Contributor
|
@kwhuber, can you remove the DS files + gitignore + env |
specifyweb/frontend/js_src/lib/components/AppResources/Editor.tsx
Outdated
Show resolved
Hide resolved
specifyweb/frontend/js_src/lib/components/AppResources/EditorWrapper.tsx
Outdated
Show resolved
Hide resolved
e7437af to
7e06b4d
Compare
Iwantexpresso
approved these changes
Dec 11, 2025
Contributor
Iwantexpresso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Go to App Resources
- Create a new Form Definition under Global Resources and copy one of the defaults (for example, "Vertpaleo")
- Name it something other than the name of the one you copied
- Switch to the XML editor and see that the "name=" value is of the name that you defined (not of the default Form Definition you copied)
Nice! This looks great Kaden.
Triggered by 27e2049 on branch refs/heads/issue-5168
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5168
EditorWrapper.tsxis where the template XML lives and eventually what the editor receives. By replacing the<viewset name>attribute, the editor will receive the user provided resource name before the XML reaches the editor. There are a few cases to look out for so the XML doesn’t break. For example, the following input could cause issues, emphasizing the need to replace them to XML entities:&resolved to&,<resolved to<, etc.The majority of the fix came from defining a few new functions,
replaceViewsetName,escapeXML, andreplaceViewsetNameInXml. The first is defined withinEditorWrapper.tsxand the latter two in a new utility file calledxmlUtils. The fix makes the XML editor display the user inputted resource name (when it is provided) instead of the template name.replaceViewsetNameInXmlextracts the resource name from the resource parameter and replaces the first occurrence of the<viewset name>attribute using the following regex:specify7/specifyweb/frontend/js_src/lib/components/AppResources/xmlUtils.ts
Line 18 in 27e2049
More changes were added to this fix in
Editor.tsx. This is necessary if the user alters their originally defined name to something else.Checklist
self-explanatory (or properly documented)
Testing instructions
Example
Screen.Recording.2025-11-24.at.1.31.19.PM.mov