I try to get dinamicaly the name of the fields and then it fails. It works if I write the name between quotes.
var elms = this.getElementsInfo('select');
var name1 = elms[0].attributes.name;
var name2 = elms[1].attributes.name;
utils.dump(name1); // "tb|2564"
utils.dump(name2); // "tb|19"
This works:
this.fill('form#tbsa', {
"tb|2564": 10,
"tb|19": 15
}, true);
This fails:
this.fill('form#tbsa', {
name1: 10,
name2: 15
}, true);
Anybody knows why? Thanks, - Albin
You can't do it in the way you do at the moment, because this will set the values of the properties name1
and name2
.
If you want to to it by the parameter names in a variable you have to create the object first.
This would be following code:
var foo = {};
foo[name1] = 10;
foo[name2] = 15;
this.fill('form#tbsa', foo, true);