-
26 Sep 2012 7:45 AM #1
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
-
26 Sep 2012 8:01 AM #2
I see you are using a datefield. See if this will help:
Scott.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() }] });
-
26 Sep 2012 8:48 AM #3
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.


Reply With Quote