Skip to content

fix: clear rawInput when removing repetition groups#446

Merged
tkuhn merged 1 commit intomasterfrom
fix-placeholder-swap-after-validation-error
Apr 22, 2026
Merged

fix: clear rawInput when removing repetition groups#446
tkuhn merged 1 commit intomasterfrom
fix-placeholder-swap-after-validation-error

Conversation

@tkuhn
Copy link
Copy Markdown
Contributor

@tkuhn tkuhn commented Apr 22, 2026

Summary

  • Fixes Placeholder values swapped when removing statement after form validation error #445: after a template form fails validation, removing a repetition group left the removed statement's placeholder value visible at the slot that took its place.
  • Root cause: Wicket retains each FormComponent's rawInput after a failed validation and uses it for rendering instead of the model value. RepetitionGroup.remove() shifted model values down but didn't clear the stale rawInput, so the shifted-in value was masked.
  • Fix: after each value swap (and the final clear) in remove(), walk context.getComponents() and call clearInput() on any FormComponent bound to the affected model.

Test plan

  • Fill a template with a repeatable statement, create 3+ repetitions with distinct values
  • Submit to trigger a validation error
  • Click "−" on the first or middle repetition
  • Confirm the values in the remaining slots correspond to the post-shift state (not the removed entry's value)
  • Re-submit and verify nanopub contents match what is displayed

🤖 Generated with Claude Code

When a template form fails validation, Wicket retains each FormComponent's
rawInput and uses it during re-render instead of the model value. Removing a
repetition group then shifted model values down but left the original rawInput
on the remaining TextFields, so the removed statement's placeholder value
stayed visible at the slot that took its place (issue #445).

Clear the rawInput of each FormComponent whose model was shifted so the new
model value is actually rendered.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tkuhn tkuhn merged commit f4f5f4f into master Apr 22, 2026
8 checks passed
@tkuhn tkuhn deleted the fix-placeholder-swap-after-validation-error branch April 22, 2026 08: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.

Placeholder values swapped when removing statement after form validation error

1 participant