Commits

Anonymous committed ee1ac6a

Moved function to evaluate the input fields into a separate function. Call
this function on pageload to evalute all fields.

Comments (0)

Files changed (1)

formbar/templates/formbar.js

 /*
  * Evaluate when values in the form changes 
 */
-$('div.formbar-form form input').change(function() {
+evaluateFields();
+$('div.formbar-form form input').change(evaluateFields);
+
+function evaluateFields() {
     var fieldsToEvaluate = $('.formbar-evaluate');
     for (var i = fieldsToEvaluate.length - 1; i >= 0; i--){
         var field = fieldsToEvaluate[i];
         var tokens = expr.split(" ");
         var eval_expr = "";
         for (var j = tokens.length - 1; j >= 0; j--){
-            var tfield = null
-            var value = null
+            var tfield = null;
+            var value = null;
             if (tokens[j].contains("$")) {
                 tfield = tokens[j].replace('$', '');
                 value = $('input[name='+tfield+']').val();
             } else {
                 eval_expr += tokens[j];
             }
-        };
+        }
         try {
             var eval_value = eval(eval_expr);
             $('#'+id).text(eval_value);
             console.log(e);
             $('#'+id).text("");
         }
-    };
-});
+    }
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.