Knockout-Contrib / Knockout-Contrib/Knockout-Validation

setError doesn't update/show the error message unless isModified is called

Open
#586 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1k
Forks
366
PR merge metrics
No merged PRs in 30d

Description

If the value is not modified before setError is called then you must also call isModified afterwards. I didn't find this documented anywhere (it was pointed out on stack overflow http://stackoverflow.com/questions/12491069/can-i-manually-add-error-messages-in-knockout-validation) so it seems like incorrect behaviour to me.

Example can be seen at http://jsfiddle.net/fq1098pu/. Uncomment the isModified line to see that this fixes the issue, but probably shouldn't be necessary.

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior in the linked JSFiddle by calling setError before isModified, then locate the validation code that handles those calls. The issue is done when the error message is updated and shown without requiring a later isModified call; add a regression check if the repository has tests for this behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.