Hybrid View

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    20
    Vote Rating
    0
    paritalak is on a distinguished road

      0  

    Default Trying to apply date to text box

    Trying to apply date to text box


    I downloaded ExtJs 4.1. What I am trying to do is apply date to the normal text box.
    Fighting on this issue from past one week.
    Following is the code

    <html lang="en">
    <head>
    <title>Welcome to Ext JS 4.1</title>
    <script language="javascript" src="ext-all.js"></script>
    <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css"/>
    <script language="javascript">
    Ext.onReady(function() {
    Ext.each(Ext.query('.date'), function(el) {
    new Ext.form.DateField({
    applyTo: el,
    format: 'Y-m-d'
    });
    });
    });
    </script></head>
    <body>
    <input type="text" class="date" name="three" value="0000-00-00"/><br>
    </body>
    </html>

    Appreciate any help. Where I am doing wrong

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    7,190
    Vote Rating
    195
    scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold

      0  

    Default


    I see you are using a datefield. See if this will help:

    Code:
    Ext.create('Ext.form.Panel', {
        title: 'Contact Info',
        width: 300,
        bodyPadding: 10,
        renderTo: Ext.getBody(),
        items: [{
            xtype: 'datefield',
            fieldLabel: 'Date',
            format: 'Y-m-d',
            value: new Date()
        }]
    });​
    Scott.

  3. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    20
    Vote Rating
    0
    paritalak is on a distinguished road

      0  

    Default


    My intention is to convert regular text filed into ExjJs date field on page load.
    What you give is that will create date in a panel.This will defenitely work.

    I tried so many different ways to convert the text field to Ext Date on EXT Onready event, but none of them seems to be working.
    Please help me on this.