Allow two decimal symbols on doublespinner

asked 2013-03-08 14:03:10 +0800

cocoes gravatar image cocoes flag of Spain
94 6


In my country the decimal symbol separator is "," , but a lot of users use the numeric keyboard with the "." for decimal separator.

I've tryed to capture the onkeypress event, in order to automatically change the "." symbol for "," , but it seems like the doublespinner event listener captures the "." key pressed event before I can do it, so the event of the "." key never goes through my event listener:

<zk xmlns:w="http://www.zkoss.org/2005/zk/client">
<script type="text/javascript">
    function submitonenter(evt,thisObj) {
        evt = (evt) ? evt : ((window.event) ? window.event : "")
        if (evt) {
           // do change "." for ","
<doublespinner id="myPrice" value="0"  w:onKeyPress="submitonenter(event,this);" constraint="no negative, min 0" />

So the question is if there's any way to capture events before doublespinner blocks some characters.



delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-12 11:10:59 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi You can specify a locale and format attribute to the doublespinner

<doublespinner value="123456789" format="###,###" locale="es_ES"/>
link publish delete flag offensive edit


Hi jimmyshiau, I've tested it but it doesn't works as I need. It lets me introduce the ".", but it's removed before I can capture the ON_CHANGE event in the server side ; and capturing the javascript event onKeyPress to substitute "." key for "," doesn't has a full browser compatible solution.

cocoes ( 2013-03-12 15:12:33 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2013-03-08 14:03:10 +0800

Seen: 28 times

Last updated: Mar 12 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More