I am having a textbox binded with datepicker and i am applying knockout validation to it .
I need some clarification on how knockout does the Job of validation like for the textbox i have Extended required field validation first and some custom validation next to it .
My major concern is if knockout executes validation conditions even after 1st condition fails(required in mycase) then i got a problem i.e i get NULL exceptions .
Let me put this in example :
self.startDate.extend({required: true}),
self.startDate.extend({
// here i have some complex logic where i `split` date `(like self.startDate().split('/') )` date and do the following .
})
Onload my textbox will be empty with no date . is suppose complete validation check is done onload i get ERROR at split as self.startDate().split('/') where split is undefined due to no data in observable .
Things i need clarity on are :
- How validation check is done on load ?
- If onload complete validation check is done means anyway we can make Validations work in a sequential way i.e once 1st condition is done it should move to check next like that
Any suggestion are much appreciated .
sWWWi am just looking for a case where will second validation condition executes even though condition one fails . i am hoping its like aif/elseratherif- super coolself.startDatewithextendi need to make it in one set i am unable to do so . - super coolself.startDate({require: true, extender2: doSomething})- sWWself.startDate({require: true, extender2: doSomething})willextender2does even excecute ifrequire:truefails . - super cool