Commits

Pedro Lima committed 8327622

In the search help list, if the SH does not have the output field it is filtered out

Comments (0)

Files changed (2)

 - patched jQueryMobile: jQM files with a patch needed to work with BSP urls
 - sample applications: several apps that can be used as examples for developing with jQM/BSP
 
-Installation details and usage informations in the docs folder.
+Installation details and usage information in the docs folder.
 
 To get help, discuss or contribute:
 

mobiweaver/javascript/jquery.mobiweaver.searchhelp.js

                     var page = '',
                         frm = '',
                         xmldoc = $(data);
-                    self.configureSearchHelp(xmldoc);
+                    self.configureSearchHelp(xmldoc, self.options.resultField);
                     if (self.searchHelpList.length>1) {
                         for (var i=0; i<self.searchHelpList.length; i++) {
                             var sh = self.searchHelpList[i];
             return frm;
         },
 
-        configureSearchHelp: function(xml) {
+        configureSearchHelp: function(xml, output_field) {
             var shlist = [];
+            var field_in_list = false;
             xml.find('searchhelplist searchhelp').each(function(index) {
                 var fields = [];
                 $(this).find('field').each(function(index) {
                             datatype: $(this).attr('datatype')
                     });
                 });
-                shlist.push({ 
+                // check if the output field is in the field list
+                field_in_list = false;
+                for (var i=0; i<fields.length; i++) {
+                  if (fields[i].name === output_field) {
+                    field_in_list = true;
+                  }
+                }
+                // if the output field is not in a search help, that
+                // search help is not included in the search help list
+                if (field_in_list) {
+                  shlist.push({ 
                     name: $(this).attr('name'), 
                     description: $(this).attr('description'), 
                     fields: fields 
-                });
+                  });
+                }
             });
             this.searchHelpList = shlist;
         },