Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixed: B65-ZK-1585 #46

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zkdoc/release-note
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ZK 6.5.3
ZK-1701: Message for file upload is not good enough in German
ZK-1708: Clients.showNotification doesn't work when using auto mode include component
ZK-1699: Performance issue ZK-Bind getters are called multiple times
ZK-1585: Strange behavior of decimalbox on iOS and Android

--------
ZK 6.5.2
Expand Down
40 changes: 40 additions & 0 deletions zktest/src/archive/test2/B65-ZK-1585.zul
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<zk xmlns:n="native">

<label multiline="true">
Testing instruction (iOS/Android Only):

1. Change locale to Italian
2. Enter '123,45' into the first decimalbox
3. Change focus to the second decimalbox

Expected result:
1. The value of the first decimalbox should stay as '123,45'.
2. It shouldn't be trimmed to display as '123'.
3. Repeat for '123.45'
4. The result should be '12345' since '.' is now considered as 'thousands grouping delimiter'
</label>

<window
id="finestraIndex"
title="Hello World!!"
border="normal"
width="200px"
closable="true"
use="org.zkoss.zktest.test2.B65_ZK_1585_TestDecimalbox">

<label value="You are using: ${desktop.webApp.version}" />

<decimalbox
id="decimal"
value="123.45">
</decimalbox>
<decimalbox id="decimal2"></decimalbox>

<label>input type="number" :</label>
<n:input type="number" />

<label>input type="text" :</label>
<n:input type="text" />
</window>

</zk>
1 change: 1 addition & 0 deletions zktest/src/archive/test2/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,7 @@ B65-ZK-1622.zul=B,M,Window,overlapped,onFloatUp
##ztl##B65-ZK-1693.zul=B,M,Chart,Dial,DialModel
##ztl##B65-ZK-1692.zul=A,M,Widget,ClientEngine
B65-ZK-1708.zul=A,M,AuResponse,Include,defer
B65-ZK-1585.zul=B,E,NumberInputElment,localization,Tablet

##
# Features - 3.0.x version
Expand Down
23 changes: 23 additions & 0 deletions zktest/src/org/zkoss/zktest/test2/B65_ZK_1585_TestDecimalbox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.zkoss.zktest.test2;
import java.math.BigDecimal;

import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.ext.AfterCompose;
import org.zkoss.zk.ui.util.ConventionWires;
import org.zkoss.zul.Decimalbox;
import org.zkoss.zul.Window;

@SuppressWarnings("serial")
public class B65_ZK_1585_TestDecimalbox extends Window implements AfterCompose {
private Window finestraIndex;
private Decimalbox decimal;

public void onCreate$finestraIndex(Event event) {
decimal.setValue(new BigDecimal("125.76"));
}

public void afterCompose() {
ConventionWires.wireVariables(this, this);
ConventionWires.addForwards(this, this);
}
}
8 changes: 6 additions & 2 deletions zul/src/archive/web/js/zul/inp/NumberInputWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,18 @@ zul.inp.NumberInputWidget = zk.$extends(zul.inp.FormatWidget, {
return this._allowKeys || _allowKeys;
},
doKeyPress_: function(evt){
//Bug ZK-1373: ALTGR + 3 key in Spanish keyboard is a combination of Ctrl + Alt + 3 for �� sign.
//Bug ZK-1373: ALTGR + 3 key in Spanish keyboard is a combination of Ctrl + Alt + 3 for £á sign.
if (evt.ctrlKey && evt.altKey)
evt.stop();
if (!this._shallIgnore(evt, this.getAllowedKeys_()))
this.$supers('doKeyPress_', arguments);
},
getType: function () {
return zk.mobile ? 'number' : this._type;
// ZK-1585: Strange behavior of decimalbox on iOS and Android
// European locale (e.g. Italian) uses ',' for decimal point.
// However, Safari Mobile would trim the number string '123,45' to '123'
// if that string is entered into input type='number'.
return zk.mobile ? ((zk.DECIMAL == '.') ? 'number' : 'text') : this._type;
}
});
})();
Expand Down