PDA

View Full Version : Some problems with textfield



vizcano
6 Nov 2009, 12:17 AM
Hi, i'm having some problems. This is my code



{
xtype:'textfield',
fieldLabel: 'Segundo Apellido',
name: String.format('sujetos.{0}.P1.C6', config.sujeto),
id: String.format('sujetos.{0}.P1.C6', config.sujeto),
width: 293,
allowBlank:true,
listeners:{
'render': function(c) {
c.getEl().on('keyup', function() {
var valor=c.getValue();;
for(var i=0;i<valor.length;i++){
if(!isNaN(valor.charAt(i)))
var isNumber=true;
}
if(isNumber){
c.markInvalid('En este campo no se aceptan caracteres numéricos');
Ext.MessageBox.alert('Atención', 'Debe eliminar el carácter numérico incluido en el segundo apellido del propietario mayoritario.');
}
}, c)
}
}
}


The problem is that the field doesn't mark as unvalid and i dont know why it happens

I've got also another problem. I can´t use form.getForm().findField(String.format('sujetos.{0}.P1.C6', config.sujeto)).getValue() but i can use form.getForm().getValues()[String.format('sujetos.{0}.P1.C6', config.sujeto)], is it normal? I've tried to type it into firebug console without using the String.format and i have no results as well