Manually get knockout to re-evaluate a dependantObservable

后端 未结 2 992
野趣味
野趣味 2020-12-15 04:43

I am not sure if this is possible, but I have a scenario where I have a validation system which notifies my validation system when something has become valid/invalid via a d

2条回答
  •  臣服心动
    2020-12-15 05:11

    Add binding enable: formValid where formValid = ko.computed(return true if all values are valid) to submit button. This way user can not submit until form is filled properly.

    Use ko.validation.validateObservable(yourDependentObservable) to revalidate field manually

    or use yourObsevable.notifySubscribers() if yourDependentObservable depends on yourObservable.

提交回复
热议问题