Results 1 to 3 of 3

Thread: Trying to apply date to text box

  1. #1
    Sencha Premium Member
    Join Date
    Sep 2012
    Posts
    31
    Vote Rating
    0
      0  

    Default 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
    9,389
    Vote Rating
    497
      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 Premium Member
    Join Date
    Sep 2012
    Posts
    31
    Vote Rating
    0
      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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •