summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/javascript/wizard/suggestions.js
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-08-25 08:08:24 -0300
committerRenato Botelho <renato@netgate.com>2015-08-25 14:49:54 -0300
commit46bc6e545a17e77202aaf01ec0cd8d5a46567525 (patch)
tree32d18dda436ec739c67c489ceb771e8629cd926f /src/usr/local/www/javascript/wizard/suggestions.js
parent4d9801c2dbd2b3e54a39578ee62b93af66607227 (diff)
downloadpfsense-46bc6e545a17e77202aaf01ec0cd8d5a46567525.zip
pfsense-46bc6e545a17e77202aaf01ec0cd8d5a46567525.tar.gz
Move main pfSense content to src/
Diffstat (limited to 'src/usr/local/www/javascript/wizard/suggestions.js')
-rw-r--r--src/usr/local/www/javascript/wizard/suggestions.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/usr/local/www/javascript/wizard/suggestions.js b/src/usr/local/www/javascript/wizard/suggestions.js
new file mode 100644
index 0000000..4d1e127
--- /dev/null
+++ b/src/usr/local/www/javascript/wizard/suggestions.js
@@ -0,0 +1,33 @@
+
+/**
+ * Provides suggestions for state names (USA).
+ * @class
+ * @scope public
+ */
+function StateSuggestions(text) {
+ this.states = text;
+}
+
+/**
+ * Request suggestions for the given autosuggest control.
+ * @scope protected
+ * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
+ */
+StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
+ bTypeAhead /*:boolean*/) {
+ var aSuggestions = [];
+ var sTextboxValue = oAutoSuggestControl.textbox.value;
+
+ if (sTextboxValue.length > 0){
+
+ //search for matching states
+ for (var i=0; i < this.states.length; i++) {
+ if (this.states[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
+ aSuggestions.push(this.states[i]);
+ }
+ }
+ }
+
+ //provide suggestions to the control
+ oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead);
+};
OpenPOWER on IntegriCloud