-
New Feature
-
Resolution: Fixed
-
Normal
-
None
-
None
-
Security Level: Jimmy
-
None
-
ZK 8.0.3 S4
IE 11 input with readonly require focus-out before accepting edit, if the focus is on the input element when readonly is removed.
Reproduced without ZK:
<html> <input id="testtxtbx" style="background-color:red;" type="textbox" value="test"/> <script> var a = document.getElementById('testtxtbx') a.readOnly = true; setTimeout(function(){ a.readOnly = false; a.style.backgroundColor='green'; },3000) </script> </html>
workaround :
<script><![CDATA[ // IE Workaround zk.afterLoad('zul.inp', function() { var _xInputWidget = {}; zk.override(zul.inp.InputWidget.prototype, _xInputWidget, { setReadonly: function (value) { _xInputWidget.setReadonly.apply(this,arguments); var self = this; if(document.activeElement == this.$n()){ this.$n().setSelectionRange(0, this.$n().value.length); } } }); }); ]]></script>
ZK example:
select the combobox,
type a letter, then immediately hit tab to select the textbox.
In IE11, without the workaround : cannot update content
Other browsers : can update
<zk> <script><![CDATA[ // IE Workaround ----- Remove for testing zk.afterLoad('zul.inp', function() { var _xInputWidget = {}; zk.override(zul.inp.InputWidget.prototype, _xInputWidget, { setReadonly: function (value) { _xInputWidget.setReadonly.apply(this,arguments); var self = this; if(document.activeElement == this.$n()){ this.$n().setSelectionRange(0, this.$n().value.length); } } }); }); ]]></script> <style> .z-textbox:focus{ background-color:#00cc00; } </style> <zscript><![CDATA[ class MyVm{ private String cmbValue = ""; public String getCmbValue(){ return cmbValue; } public void setCmbValue(String cmbValue){ this.cmbValue = cmbValue; } } ]]></zscript> <window viewModel="@id('vm')@init('MyVm')"> <combobox instant="true" value="@bind(vm.cmbValue)" > <comboitem label="a item 1"/> <comboitem label="b item 2"/> <comboitem label="b item 3"/> </combobox> <textbox readonly="@load(empty vm.cmbValue)"/> </window> </zk>
- relates to
-
ZK-426 Onblur and readonly issue in INTBOX (IE only)
- Closed