Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User alexgomez88's Avatar
    Join Date
    Mar 2010
    Posts
    1
    I have an small problem, i want to make some TextField only for numbers and make the widget put numkey by default and not T9.

    Thks...

    Sorry for my english.

  2. #2
    Welcome Alex,
    You can do this with javascript:

    Code:
    <script>
    
    function numbersonly(e, decimal) {
    var key;
    var keychar;
    
    if (window.event) {
       key = window.event.keyCode;
    }
    else if (e) {
       key = e.which;
    }
    else {
       return true;
    }
    keychar = String.fromCharCode(key);
    
    if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) ) {
       return true;
    }
    else if ((("0123456789").indexOf(keychar) > -1)) {
       return true;
    }
    else if (decimal && (keychar == ".")) { 
      return true;
    }
    else
       return false;
    }
    
    </script>
    and input tag should looks like this:

    Code:
    <input name="number"  onKeyPress="return numbersonly(event, false)">

    I hope this helps you.

    Regards

    Dusan

  3. #3
    Nokia Developer Moderator isalento's Avatar
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    831
    It is good to note that dot is not the only decimal separator. If you are going to localize the widget consider to support comma as well.
    http://en.wikipedia.org/wiki/Decimal_separator

    -Ilkka

Similar Threads

  1. Tried and tried and still cant do it. Please help!
    By farmdve in forum Symbian Tools & SDKs
    Replies: 12
    Last Post: 2009-04-16, 10:29
  2. How to build GCCE target
    By dsiorpaes in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2008-09-18, 06:54
  3. How to create .sis file...?
    By satishkatta in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 25
    Last Post: 2008-09-04, 12:43
  4. How to install uSTL in Symbian OS
    By sindywyw in forum Symbian C++
    Replies: 13
    Last Post: 2008-08-19, 12:32
  5. Setting a TextBox / TextField to use T9 dictionary as default???
    By newmania in forum Mobile Java General
    Replies: 1
    Last Post: 2003-04-15, 07:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved