2013-04-29 122 views
1

當我選擇'禁用事件'時,我需要清除(無選擇)我的前2個單選按鈕(CMR conv +出CMR)。用敲除清除單選按鈕

是否有可能與淘汰賽?

我已經禁用它們,但我也需要清除它們。

的jsfiddle:http://jsfiddle.net/mnucj/

CMR convention: <input type="radio" name="cmrConvention" value="true" data-bind="checkedRadioToBool: cmrConvention, disable: thirdPartyInsured() ? true : false"> 
<br/> 
Out of CMR convention: <input type="radio" name="cmrConvention" value="false" data-bind="checkedRadioToBool: cmrConvention, disable: thirdPartyInsured() ? true : false"> 
<br/> 
- - - - - - 
<br/> 
Enable things: <input type="radio" name="thirdParty" value="false" data-bind="checkedRadioToBool: thirdPartyInsured"> 
<br/> 
Disable things: <input type="radio" name="thirdParty" value="true" data-bind="checkedRadioToBool: thirdPartyInsured"> 

感謝。

回答

0

您可以使用點擊點擊「禁用東西」複選框時,像這樣綁定:

Disable things: 
<input type="radio" name="thirdParty" value="true" 
     data-bind="checkedRadioToBool: thirdPartyInsured, 
        click: function() { cmrConvention(null); return true; }"> 

updated fiddle

+0

你是對的:收音機已被清除,但副作用:不再選擇'禁用事物'點擊。任何想法? – Bronzato 2013-04-29 15:30:40

+0

yup :-)匿名函數沒有返回任何東西,這會阻止「click」事件傳播,因此也不會被檢查。你必須返回一些東西來傳播。我更新了小提琴:http://jsfiddle.net/mnucj/4/ – Jalayn 2013-04-29 15:36:59

+0

很乾淨,謝謝。 – Bronzato 2013-04-29 15:38:55