Hello @rui9075918
Thank you very much for using our plugin.
Your current equation fills the object properties “price” and “txt” and concatenates them before returning the equation’s result return info['price'] + info['txt'];
But now, you want to assign the price and txt to other two fields in the form. To describe the process, I’ll call them fieldname123 and fieldname321.
In this hypothetical case, you can edit the equation as follows:
(function () {
var info = {};
switch(fieldname21){
case 1:
info.price = 10;
info.txt="A";
break;
case 2:
info.price = 20;
info.txt="B";
break;
case 3:
info.price = 30;
info.txt="C";
break;
default:
info.price = 0;
info.txt="no selection";
break;
}
getField(fieldname123|n).setVal(info['price']);
getField(fieldname321|n).setVal(info['txt']);
return info['price'] + info['txt'];
})();Note that I included two lines of code above the return instruction:
getField(fieldname123|n).setVal(info['price']);
getField(fieldname321|n).setVal(info['txt']);And pay special attention to the use of the |n modifier with the fields’ names fiedname123 and fieldname321. The plugin replaces the fields’ names with their values before evaluating the equations. The |n modifier tells the plugin you want to use the field’s name directly and not its value.
Best regards.
