Max
24 Aug 2007, 8:05 AM
Hi, i'm starting out with Ext JS trying to create a BasicForm from existing markup. This is what I have so far:
Ext.onReady(function () {
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
Ext.select('form.ingreso').each(function(el) {
var form = new Ext.form.BasicForm(el)
form.render()
el.select('input').each(function(el) {
if(el.dom.getAttribute("type") == "text") {
var field = new Ext.form.TextField().applyTo(el);
form.add(field)
field.on('blur', function() { validateForm(form) })
}
})
el.boxWrap()
})
})
I seem to have some trouble with the scopes, the form variable in the inner select-each is not the same as the outer form variable. Besides I seem to overwrite the fields in the inner each.
I'm quite new to Javascript as well, so its likely I messed up. I'll appreciate any help :)
Ext.onReady(function () {
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
Ext.select('form.ingreso').each(function(el) {
var form = new Ext.form.BasicForm(el)
form.render()
el.select('input').each(function(el) {
if(el.dom.getAttribute("type") == "text") {
var field = new Ext.form.TextField().applyTo(el);
form.add(field)
field.on('blur', function() { validateForm(form) })
}
})
el.boxWrap()
})
})
I seem to have some trouble with the scopes, the form variable in the inner select-each is not the same as the outer form variable. Besides I seem to overwrite the fields in the inner each.
I'm quite new to Javascript as well, so its likely I messed up. I'll appreciate any help :)