![](/img/trans.png)
[英]how do I set some default value for a check box or a radio button if user do not check the check box or select a button
[英]How to set back the old value of radio button when user select No from confirm Box?
我有一个问题,当用户在单选按钮上进行更改时,我必须触发“用户确认”框。
我成功触发了“确认框”,但要在收音机组中设置旧值非常困难。 任何人都有这样做的想法。 我在谷歌尝试解决方案,但没有运气。
Ext.define('CustomRadioField', {
override: 'RadioField',
setListeners: function(config) {
var me = this;
config.listeners = {
change: {
fn: function(control, newValue, oldValue, eOpts) {
var me = this;
me.fieldChanged();
Ext.Msg.confirm(MyFunction.T('Confirm'), "Are you sure want to delete?", function(btn) {
if (btn == 'no') {
//Added my logic to reset back
control.suspendEvent('change');
control.setValue(oldValue);
control.resumeEvent('change');
//End
//Added to refresh page not to reload but this location.reload post to my server insted to refresh.
location.reload();
}
if (btn == 'yes') {
}
});
}
},
scope: me
},
focus: {
fn: me.storeFocusField,
scope: me
},
afterrender: {
fn: function(f, e) {
me.setFieldFocus;
},
scope: me
},
boxready: {
fn: me.setUpChangeEvent,
scope: me
},
specialkey: {
fn: function(f, e) {
var me = this;
switch (e.getKey()) {
case e.TAB:
break;
}
},
scope: me
}
};
},
});
提前致谢
你能附上代码吗?
您可以使用field.reset()
函数重置字段值,其中field是单选按钮字段,也可以使用form.reset()
方法将表单中的所有字段重置为用户更改之前的状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.