must update sidebar form fields before serializing them

This commit is contained in:
Oliver Gorwits
2013-09-22 13:32:31 +01:00
parent 03c0d4f976
commit 052f3ed29a

View File

@@ -44,14 +44,14 @@
}
// each sidebar search form has a hidden copy of the main navbar search
// query. when the tab query takes place, copy the navbar locally, then
// replicate to all other tabs.
function copy_navbar_to_sidebar (tab) {
var form = '#' + tab + '_form';
// copy navbar value to currently active sidebar form
if ($('#nq').val()) {
$(form).find("input[name=q]").val( $('#nq').val() );
}
// then copy to all other inactive tab sidebars
$('form').find("input[name=q]").each( function() {
$(this).val( $(form).find("input[name=q]").val() );
});
@@ -63,9 +63,9 @@
[% FOREACH tab IN settings._search_tabs %]
$('[% "#${tab.tag}_form" %]').submit(function (event) {
var pgtitle = update_page_title('[% tab.tag %]');
update_csv_download_link('search', '[% tab.tag %]', '[% tab.provides_csv %]');
update_browser_history('[% tab.tag %]', pgtitle);
copy_navbar_to_sidebar('[% tab.tag %]');
update_browser_history('[% tab.tag %]', pgtitle);
update_csv_download_link('search', '[% tab.tag %]', '[% tab.provides_csv %]');
do_search(event, '[% tab.tag %]');
});
[% END %]
@@ -76,9 +76,9 @@
[% FOREACH tab IN settings._device_tabs %]
$('[% "#${tab.tag}_form" %]').submit(function (event) {
var pgtitle = update_page_title('[% tab.tag %]');
update_csv_download_link('device', '[% tab.tag %]', '[% tab.provides_csv %]');
update_browser_history('[% tab.tag %]', pgtitle);
copy_navbar_to_sidebar('[% tab.tag %]');
update_browser_history('[% tab.tag %]', pgtitle);
update_csv_download_link('device', '[% tab.tag %]', '[% tab.provides_csv %]');
[% IF tab.tag == 'ports' %]
// to be fair I can't remember why we do this in JS and not from the app