Skip to content

fix(varmodel): keep the new data variable form open on invalid input - #200

Merged
ehennestad merged 1 commit into
devfrom
validate-new-data-variable-at-save
Nov 8, 2026
Merged

ehennestad merged 1 commit into
devfrom
validate-new-data-variable-at-save

Conversation

@ehennestad

Copy link
Copy Markdown
Collaborator

uiCreateDataVariableFromFile checks the entered values after tools.editStruct has returned and reopens the form in a loop until they are valid. A name that is already in use passes those checks. VariableModel.insertItem refuses it after the form has closed, so the entered values are lost.

Changes:

  • The form passes a ValidationFcn (feat(structeditor): let ValidationFcn refuse to save entered values #182), so it stays open and shows the reason at Save. The reopen loop is removed.
  • The check refuses an empty name, a name that fails isvarname, a name the variable model already contains, and a file name expression that is empty or does not match the file.
  • A problem with the name and a problem with the expression are reported together.
  • The batch selector skips the name field, so only the expression is checked there.
  • CreateDataVariableDialogTest covers the check and the output of the form, in a temporary project with a stub of tools.editStruct.

All of these problems now appear in an error dialog titled "Invalid Input".

Closes #199

🤖 Generated with Claude Code

uiCreateDataVariableFromFile checked the entered values after the
window had closed and reopened the form in a loop until they were
valid. A name already in use passed those checks and was refused later
by insertItem, after the form had closed, so the entered values were
lost.

The form now passes a ValidationFcn, so it stays open and shows the
reasons at Save. The check also refuses a name the model already
contains, and reports problems with the name and the file name
expression together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ehennestad ehennestad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Test Results

657 tests  +12   657 ✅ +12   1m 31s ⏱️ +9s
 52 suites + 1     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 4adb3ed. ± Comparison against base commit deaeee6.

@ehennestad
ehennestad merged commit ecf8a54 into dev Nov 8, 2026
5 checks passed
@ehennestad
ehennestad deleted the validate-new-data-variable-at-save branch November 8, 2026 16:22
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.

1 participant