PDA

View Full Version : datefield applyto



aeiou
4 Sep 2009, 7:19 AM
Hi
This can be a silly question, but I am a bit frustrating.

I dont understand why this code


var domDate = Ext.DomQuery.selectNode ('input[name=datebis]');

var dtfield = Ext.form.DateField ({
allowBlank: false,
applyTo: domDate
})
does'nt work but this one:


var boxes = Ext.DomQuery.select ('input[tag=date]');
Ext.each (boxes, function (item, index, all) {
var fstDate = new Ext.form.DateField({
allowBlank : false,
format: 'm-d/Y',
maxValue: '12/09/2009',
maxText: 'This date overpass the max date',

applyTo: item
}) // eo DateField
}) // eo each
do, it means, the first snippet raise a (Ext) error on firebug but the second one renders the DateField properly.
I know Ext.DomQuery.selecNode (...) returns just one item with the same type that the items in the Ext.DomQuery.select(...) return array, so I guess I am trying to render to the same thing.

any comment is very welcome.
sorry if this is an annoying question
regards

Condor
4 Sep 2009, 7:29 AM
1. You are executing this from Ext.onReady?
2. Are you sure the input[name=datebis] selector returns an <input type="text">?

aeiou
4 Sep 2009, 8:13 AM
1. You are executing this from Ext.onReady?
2. Are you sure the input[name=datebis] selector returns an <input type="text">?
yes, actually i didnt wanted to post the entire scriptlet as it is just a script to test the DateField capabilities. What i want to do further is to embed DateField in a larger web application, but first i gotta know it can do everything i want.

If you want, i can post the html and js files... they are tiny but a bit messy :s

thanks for the quick reply
regards