Hugely simplify setting up the on-submit actions for search forms.
authorMike Taylor <mike@indexdata.com>
Fri, 28 Feb 2014 12:45:19 +0000 (12:45 +0000)
committerMike Taylor <mike@indexdata.com>
Fri, 28 Feb 2014 12:45:19 +0000 (12:45 +0000)
tools/htdocs/mkws.js

index be3c996..a15324b 100644 (file)
@@ -984,15 +984,10 @@ function team($, teamName) {
            $(document).ready(function() { mkws.resize_page() });
        }
 
-       $('.mkwsSearchForm.mkwsTeam_' + m_teamName).each(function (i, obj) {
-           debug("adding search-forms for team '" + m_teamName + "'");
-           var node = this;
-           mkws.handle_node_with_team(this, function(tname) {
-               debug("adding search-form '" + tname + "' for team '" + m_teamName + "'");
-               $(node).submit(onFormSubmitEventHandler);
-           });
-       });
-
+       var node;
+       node = $('.mkwsSearchForm.mkwsTeam_' + m_teamName);
+       if (node.length)
+           node.submit(onFormSubmitEventHandler);
        node = $('.mkwsSort.mkwsTeam_' + m_teamName);
        if (node.length)
            node.change(onSelectDdChange);