1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    29
    Answers
    4
    Vote Rating
    0
    josephkirubakaran is on a distinguished road

      0  

    Default Unanswered: How to convert a html input text field to Ext js number field?

    Unanswered: How to convert a html input text field to Ext js number field?


    Hello,

    I am using ExtJs 4.

    I have a html page with a form. In that page I just want to convert a single input text field to a Ext js numeric field. I donno how to do that..

    Here i dont have any Ext js form/panel. I need only one ext js number field and nothing else.

    I have searched a lot for this and couldn't find the solution.. Can any one help me to do this?

    Thanks in advance.

  2. #2
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    Here's a simple/ugly example. Note the use of the 'renderTo' attribute on the Number field:

    Code:
    <!DOCTYPE HTML>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>CheckboxModel Test</title>
        <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
        <script type="text/javascript" src="extjs/ext-all-debug-w-comments.js"></script>
        <script type="text/javascript">
          Ext.Loader.setConfig({enabled:true});
          
          Ext.onReady(function() {
            Ext.create('Ext.form.field.Number', {
              fieldLabel: 'Age',
              maxValue: 100,
              minValue: 0,
              name: 'age',
              renderTo: 'ageField'
            });
          });
        </script>
      </head>
    
      <body>
        <form action="someAction" method="post">
          <label>Name:</label> <input type="text" name="lastName"> </br>
          <div id="ageField"></div>      
        </form>
      </body>
    </html>

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    29
    Answers
    4
    Vote Rating
    0
    josephkirubakaran is on a distinguished road

      0  

    Default


    Thank you friend.. But i want the same for input type and not for div. The given code is not woking when i change like
    Code:
    <input type="text" id="ageField"/>
    Actually i am wrtting a common logic to upgarde all the input fields to number field based on the class it contains (say "numberField").

    So is it possible?

  4. #4
    Sencha User
    Join Date
    Apr 2010
    Posts
    29
    Answers
    4
    Vote Rating
    0
    josephkirubakaran is on a distinguished road

      0  

    Default


    Can any one help to do this?

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    ren_sk8er is on a distinguished road

      0  

    Default


    How to do this? I want to know the answers here. Same as html input text to ExtJS textfield

Thread Participants: 2

Tags for this Thread