0

I been working on custom binding handlers to bind formatted value to my text-box and i'm pretty successful with that . Here i am adding a validation (required:true,number:true) on the same text-box i'm referencing to .

Binding Handler Code:

ko.bindingHandlers.autoNumeric = {
//my code goes here 
}

My binding handler code looks something like this

View :

<div data-bind="foreach:arraylist">
    <input type="text" data-bind="autoNumeric:$data.Amount" />
</div>

ViewModel :

self.add = function(){
self.arraylist.push(new myfun());
}

When i click on add i will add new row to the array with amount so here binding handler autoNumeric will also gets fired because of the binding and observable associated which in-turn will make my validation fire and display error message enter something which i want to avoid .

For validations i'm using validatedobservable inside to it using .extend({required:true}) .

Any interesting suggestions are appreciated .

super cool
  • 6,003
  • 2
  • 30
  • 63
  • Please, be more specific. If you have a required validation it's natural that the `enter something` appears there. I don'tunderstand what you need to do. – JotaBe Nov 26 '14 at 17:42
  • well ok in short i don't want to show validation message when i click on `add` i should show message if i press save only . if i use normal `value` binding there is no issue `no messaged displayed` . – super cool Nov 27 '14 at 15:04
  • mate , have any idea how to hide validation messages on load ? i tried diff things but nothing comes handy . – super cool Nov 27 '14 at 15:05
  • So what you want is that the validation message doesn't appear when the model is first bound, and then it appears when the user enters the control, and gets out of it? If so, please, open a question so that I can give an answer. Too long for a comment, and hidden for other people that have the same problem. – JotaBe Nov 28 '14 at 09:30
  • here we go mate this one long back posted by me you can share your view so many can appreciate it http://stackoverflow.com/questions/25621779/hide-validation-messages-onload-knockout . thank you – super cool Nov 28 '14 at 14:52

0 Answers0