View Full Version : how do you create a Ext.form.DateField, its not showing up?

12 May 2011, 1:59 PM
im trying this piece of code and nothing is showing up

am i missing something?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="ext-4.0.0/resources/css/ext-all.css">
<script src="ext-4.0.0/ext-all.js" type="text/javascript"></script>
<script src="ext-4.0.0/ext-debug.js" type="text/javascript"></script>
<h3>Date Field test</h3>
<input type="text" id="field_nw_enddate" name="nw_enddate" value="" class="ifktextfield" />
<div id="dt"></div>
<script type="text/javascript">

var dt = new Ext.form.DateField({
id: 'BirthDate',
fieldLabel: 'Birth date',
format: 'd/m/Y',
value: new Date('02/01/2011'),
minValue: '02/01/2011',
maxValue: '31/01/2011',
allowBlank: false,
applyTo: 'dt',
anchor : '32%'



13 May 2011, 9:26 AM
I see from your script includes that you're using ExtJs v4, but you're trying to use the 'ExtJs v3 way' of object creation.

So, two choices:

1.) Use ExtJs v3 and your code will work.
2.) Read about Ext.create() in the the Ext v4 API documentation.