PDA

View Full Version : reload the form fields values



janixams
14 Oct 2007, 8:18 PM
Hi all:
I need to refresh the form fields when I change its values. How can I do that..???
Thank you. :((

Animal
14 Oct 2007, 10:38 PM
Form.load()?

janixams
15 Oct 2007, 6:56 PM
Thank you for your help, but my function is not working yet.
I try your way, something like this:


function llenarCampos(){
var datos = my_form.findField('combo_polo').getValue(); //en datos SI esta el valor deseado

var store_field = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'polo_generator.php?seleccionado=datos'}),
reader: new Ext.data.JsonReader({root: 'otro'},['nombre', 'objetivos', 'fechaCreacion', 'investigacion', 'perfil']),
remoteSort: false
});

store_field.on('load',function(){
my_form.findField('nombre').setValue(store_field.getAt(0).data.nombre);
my_form.findField('objetivos').setValue(store_field.getAt(0).data.objetivos);
my_form.findField('invest').setValue(store_field.getAt(0).data.investigacion);
my_form.findField('perfil').setValue(store_field.getAt(0).data.perfil);
my_form.findField('fecha').setValue(store_field.getAt(0).data.fechaCreacion);
});
store_field.load();
my_form.load();
};

What do you think about this??
Regards

janixams
15 Oct 2007, 7:06 PM
Actually the reaal problem is in this code:

my_form.findField('objetivos').setValue(store_field.getAt(0).data.objetivos);
store_field.getAt(0).data.objetivos does not have data.
????? :((

Thanks a lot.

Animal
15 Oct 2007, 11:18 PM
Don't use JsonReader or a Store, just use the simple way. Just return JSON as described in the docs and Form.load() will work.

janixams
17 Oct 2007, 3:58 AM
Hello Animal:
I will explain to you. I have a form with a comboBox and others fields. The user must to select a comboBox item and the others field take value. I use a handler on the select comboBox function to call:


function llenarCampos(){
.....
};
I am confused, because I could have a simple JSON response but I don't know wich data must be until the user select one of the items in a comboBox in the same form. So, I do a query according to those specific data. So, this JSON response can't be obtained before.
Do you think I can have a simple JSON response now..???
Thank you in advance
:s