Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched to returning the value of each error, not an observable #384

Merged
merged 1 commit into from
Dec 18, 2013

Conversation

stevegreatrex
Copy link
Contributor

Fixes #383 (& relates to #357)

Slightly debatable, but as explained in the issue I can't see why you anyone would want to return the observables. I'll leave this open for a while before merging in case anyone wants to complain.

Note that this is also the behaviour of the library from before the recent spate of refactoring

stevegreatrex added a commit that referenced this pull request Dec 18, 2013
…vables

Switched to returning the value of each error, not an observable
@stevegreatrex stevegreatrex merged commit 999d8e2 into master Dec 18, 2013
@stevegreatrex stevegreatrex deleted the 383-group-returns-observables branch December 18, 2013 16:26
@jonathancounihan
Copy link

Hi @stevegreatrex, apologies for the delay in commenting, I only stumbled upon this today, but I thought I would add my 2 cents.

I grabbed the latest code from master today because I needed the fix for #374. However I am actually reliant on the behavior where the observables are returned and not the error messages directly. I collect the error message observables and use them in a separate summary list. As the user edits or fixes the errors the text changes, and that is propagated to the summary list display.

However now I just get the error text, and use the new live option and it all seems to be ok!

Thanks for the effort!

@mryellow
Copy link

hmm...

I was using this.errors = ko.validation.group(this);, which added isValid to the model and worked perfectly.

Seems this change may be the culprit that broke this approach?

Using ko.validatedObservable seems to require a different pattern for the models, I'm using a constructor not a singleton object...

@crissdev
Copy link
Member

@mryellow See #465 #225

More information about the changes here #469

@mryellow
Copy link

Thanks for the heads-up, wasn't the best post and mostly me causing pollution. My repo was setup wrong and I had been pulling master branch, downgraded to v1.0.2, singleton group didn't seem to apply rules.

Calling init was needed... Maybe worth adding this case to some documentation somewhere, took awhile but I found someone doing it this way .

ko.validation.init({
    parseInputAttributes: true
});

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.

group returns observables in errors array, not the value
4 participants