PDA

View Full Version : Setting ID's in Ext.form.DateField?



San
28 Feb 2007, 5:55 AM
Is there a way to set the Ext.form.DateField 'id' and 'name' before render?

This doesn't work:


function setup() {
var d = new Ext.form.DateField({id:'test_form', name:'test_name'});
d.render('container');
d.setValue('01/01/08');
}


I end up with this:


<div id="container">
<div style="width: 109px;" id="ext-gen7" class="x-form-date-wrap"><input title="" class="x-form-field" id="ext-gen6" size="16" autocomplete="off" type="text"></div></div>



<input name="commit" value="Create" type="submit">
</p>
</form>



On the list of Ext sugar to make things sweet: it would be great if we could just specify a field name to transform into a date picker.

A nice time picker would make my day too.

jack.slocum
28 Feb 2007, 9:04 AM
In the next rev coming shortly you can do all of the following:


var d = new Ext.form.DateField({
id:'test_form',
name:'test_name'
});
d.render('container');
d.setValue('01/01/08');

var d = new Ext.form.DateField({
id:'someId' // <-- name will default to id
});
d.render('container');
d.setValue('01/01/08');


var d = new Ext.form.DateField({
id:'test_form',
name:'test_name',
value: '01/01/08'
});
d.render('container');


var d = new Ext.form.DateField({
target:'existing-element', // <-- does not mess with id or name
value: '01/01/08'
});