Skip to content

Instantly share code, notes, and snippets.

@thenoseman
Last active January 26, 2017 13:36
Show Gist options
  • Save thenoseman/8d70303b5262813f23c8cfbb021d88ea to your computer and use it in GitHub Desktop.
Save thenoseman/8d70303b5262813f23c8cfbb021d88ea to your computer and use it in GitHub Desktop.
Form-O-Fill : Reading the runtime state in before functions
var rules = [{
"name": "The default rule",
"url": "https://form-o-fill.github.io/tutorial/tour-1.html",
"autorun": true,
"before": function(resolve, context) {
console.warn("Rule manually triggered? %s", context.state.ruleManuallyTriggered);
console.warn("Rule automatically triggered? %s", context.state.ruleAutomaticallyTriggered);
console.warn("Rule part of workflow? %s", context.state.ruleRunningInWorkflow);
resolve();
},
"fields": [{
"selector": "input[type=text]",
"value": "Welcome!"
}]
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment