fix(input): sync reactive model when the numeric guard reverts a character - #440
fix(input): sync reactive model when the numeric guard reverts a character#440gkbishnoi07 wants to merge 2 commits into
Conversation
…acter The allowText/StringValidator guard reverts a rejected character in the DOM (event.target.value = lastVal) but never updated the reactive FormControl, so the value accessor could keep the rejected char in the saved payload while the visible box looked clean. Re-emit 'input' after a revert so the corrected value is written back into the model; guarded against re-entrancy so the (now valid) re-emitted event cannot recurse. Fixes MMU bugfest [15] for Duration and other numeric fields.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| this.validateEntry(val, lastVal, maxlength, event); | ||
| } | ||
|
|
||
| // If a guard above reverted/overrode the visible value, the reactive form |
|



What
Duration / numeric fields accepted letters into the saved payload. The
StringValidatorDirectivereverted the visible character but never synced the reactive-form model, so a rejected character could persist in the value sent to the backend.Fix
Add a guarded model re-sync in
StringValidatorDirectiveso the reactive control matches the (cleaned) visible input.Testing
Shared directive — verify across numeric fields (Chief Complaints / Personal History Duration, vitals, registration): typing letters is rejected on screen and not saved. (QA: Duration field is taking char as input.)