disable checkbox from custom binding

53 views
Skip to first unread message

toby...@gmail.com

unread,
Jul 4, 2014, 11:31:47 AM7/4/14
to knock...@googlegroups.com
Hello,

I have three checkboxes

<input type="checkbox" name="item_meta[202][]" id="field_202-0" value="morning" data-bind="checked:period, selectedDate:reservationDate">
<input type="checkbox" name="item_meta[202][]" id="field_202-1" value="afternoon" data-bind="checked:period, selectedDate:reservationDate">
<input type="checkbox" name="item_meta[202][]" id="field_202-2" value="evening" data-bind="checked:period, selectedDate:reservationDate">

And i have made a custom binding handler for selectedDate.
From selectedDate i check / uncheck checkboxes depending of the value of reservationDate.

The function to check the checkbox is: 
bindingContext.$data.period.push("morning");

After the execution of this function, i want to disable the checkbox. I have no idea how to arrange this?!

I can use a disable binding in the HTML, but i want to disable only one checkbox and not all three checkboxes.

Hopefully someone can help me.
Thanks in advance.

Gunnar Liljas

unread,
Jul 4, 2014, 12:20:37 PM7/4/14
to knock...@googlegroups.com
Could you make a small JSFiddle with this? Honestly, it doesn't quite sound like this should be a job for a custom binding handler.

/G 

--
You received this message because you are subscribed to the Google Groups "KnockoutJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knockoutjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

toby...@gmail.com

unread,
Jul 5, 2014, 6:33:35 AM7/5/14
to knock...@googlegroups.com
Hello,

I'am not very familar with fiddle.


but it does not work :-( Hopefully you understand what i want.

toby...@gmail.com

unread,
Jul 5, 2014, 6:49:17 AM7/5/14
to knock...@googlegroups.com, toby...@gmail.com
Fiddle is working now.

Gunnar Liljas

unread,
Jul 10, 2014, 3:10:13 AM7/10/14
to knock...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages