PluginProbe
Smart Forms – when you need more than just a contact form / 0.5
Smart Forms – when you need more than just a contact form v0.5
trunk 0.5 0.5.5 0.6 0.7 0.8 0.8.5 0.9.1
smart-forms / js / formBuilder / formula / formula.js

formula.js in Smart Forms – when you need more than just a contact form 0.5, at js/formBuilder/formula/formula.js

25 lines 747 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function RedNaoFormula(formElement,formula)
2 {
3 this.FormElement=formElement;
4 this.Formula=formula;
5 }
6
7 RedNaoFormula.prototype.FieldUsedInFormula=function(fieldName)
8 {
9 for(var i=0;i<this.Formula.FieldsUsed.length;i++)
10 {
11 if(fieldName==this.Formula.FieldsUsed[i])
12 return true;
13 }
14
15 return false;
16 }
17
18 RedNaoFormula.prototype.UpdateFieldWithValue=function(value)
19 {
20 var calculatedValue=eval(this.Formula.CompiledFormula)(value);
21 if(typeof calculatedValue=='number'&&isNaN(calculatedValue))
22 calculatedValue=0;
23 RedNaoBasicManipulatorInstance.SetValue(this.FormElement.Options,this.Formula.PropertyName,calculatedValue,this.Formula.additionalInformation);
24 this.FormElement.RefreshElement();
25 }