0
votes

I am researching the knockout validator plugin. I have an input text control in the view:

Prefix:
<input data-bind = "value: Prefix" />

I am doing some validation on the Prefix observable variable:

Prefix.extend({
            minLength: 3,
            required: true
        });

The validation is working but when I enter one character in the input text box and change the focus the message for required rule is shown, not that for minLength. I tried some alternative syntax:

Prefix.extend({ required: true })
            .extend({ minLength: 3 })

But nothing changes. If I enter the minimum required characters and then delete them one by one, the correct rule messages are triggered (minLength message and required message when no characters are left). I am not very much familiar with javascript and I cannot figure out what am I doing wrong. Any help will be appreciated. Thank You!

1
EDIT: This issue is reported here : github.com/ericmbarnard/Knockout-Validation/issues/47 According to the author its fixed, but I can still reproduce it in my code. Maybe I should write there. - Mdb

1 Answers

1
votes

Check the version of knockout you're using. I ran into this issue and found that I was using knockout 2.0.0, the newest version (2.1.0) seems to fix this issue.