我有一個問題與Internet Explorer(10節現在)我有2個單選按鈕是/否與確認框,如果用戶點擊取消,該值應該回到原來的值IE10事件:與確認(其他城市)不重置值前值
例:yes爲默認值。用戶點擊否,彈出顯示 - 用戶取消應該返回到是。 問題...值不會改變它停留在無
在Firefox和GoogleChrome
我的代碼做工精細見的jsfiddle(您必須在IE10中打開它,我認爲...)
enter code here
https://jsfiddle.net/grosjambon/nxy0g1cg/
請評論,如果的jsfiddle不起作用
EDIT1
找到東西放在這裏它的工作,但有一個小問題。當我嘗試在道路功能多參數綁定淘汰賽做在點擊綁定,當「人」確認更改值,該值不更新單選按鈕(包括無線電有內他們什麼)
HTML
<input class="radio-inline" type="radio" data-bind="click: function(data,event){confirmCheck2(lang('Options1'),false, '1Group0', data, event)}, checked: IsSomething,checkedValue: true" />
<input class="radio-inline" type="radio" data-bind="click: function(data,event){confirmCheck2(lang('Options1'),true, '1Group0', data, event)}, checked: IsSomething,checkedValue: false" />
有按下OK鍵確認問題(包括收音機空)
是工作,但沒有額外的屬性
m.confirmCheck2 = function (propertyName, inputValue, stepName, data, event) {
console.log(event);
if (!confirm("Are you sure?")) {
event.stopImmediatePropagation();
return false;
}
return true;
}
方法
視圖模型(淘汰賽)方法
HTML
<input class="radio-inline" type="radio" data-bind="click: confirmCheck, checked: IsITARAndCGP,checkedValue: true" />
視圖模型
m.confirmCheck = function (data, event) {
console.log(data);
console.log(event);
if (!confirm("Are you sure?")) {
event.stopImmediatePropagation();
return false;
}
return true;
}
EDIT 2所以在應答之間,我發現用羅伊的舊答案的解決方案。 P.S如果我們複雜的問題:所以我有多個屬性m.Property1 m.Property2,m.Property3。當1爲真時,所有其他都是假的,如果真實屬性變爲假,則一切都是錯誤的。只有1個值可以是真實的。
因此,與當您更改值RoyJ的以前的答案,這將觸發具有確認彈出,因爲所有的財產3觸發相同確認每個屬性訂閱。
var showPopup = true;
m.Property1.subscribe(function() {
var inputValue = m.Property1();
if (showPopup) {
if (confirm(f.lang("Message"))) {
showPopup = false;//Disable showPopup because we set value inside resetValueFunction
resetValueWithCondition("Property1"), inputValue);
} else { // if cancel
showPopup = false;
m.Property1(!inputValue);
return true;//Exit code
}
}
showPopup = false;//Disable showPopup because we set value inside resetValueFunction
resetValueWithCondition("Property2", inputValue);
showPopup = true;
});
m.Property2.subscribe(function() {
var inputValue = m.Property2();
if (showPopup) {
if (confirm(f.lang("Message"))) {
showPopup = false;//Disable showPopup because we set value inside resetValueFunction
resetValueWithCondition("Property2", inputValue);
} else { // if cancel
showPopup = false;
m.Property2(!inputValue);
return true;//Exit code
}
}
showPopup = true;
});
功能resetValueWithCondition
function resetValueWithCondition(propertyName,inputValue) {
if (!m.Property1() && !m.Property2()) {//In this If I hide every field in my form and set Property 1 and Property2.... to false.
//m.Step1Visiblity(false);
resetFormValueAfterStepPosition('1Group0');//Reset all form field
setPropertyValue(false, false);//Here is simply m.Property1(false) etc...
} else {
resetFormValueAfterStepPosition('1Group0');//Reset all form field
if (inputValue == true) {//Only perform this method if Property goes to True, otherwise don't execute (otherwise it trigger the confirm box multiple time when I Set Propertyvalue
m.visibilityLogic(propertyName);//Set PropertyValue to either true,false or false,true if is it property1 or property2
}
}
}
那是錯誤的小提琴,原因是其擁有無關,與你的問題 – QBM5
應該是不錯的吧?我編輯了一個Linked。 – Guillaume