Bug 7607: Remove empty inputs when submitting search form
This patch surrounds the operator, index, and query fields on the advanced search page wtih a 'search_set' class. This allows us to process them as a group and confirm the query is populated before submitting the other parts to the form TO test: 1 - Go to advanced search 2 - Use search boxes to search like: Title: (leave blank) Author: clinton keyword: shuffle 3 - Perform search 4 - Note no results as you searched for title:clinton etc. 5 - apply patch 6 - refresh and repeat 7 - search is now correct 8 - Try vaeious searches with 'more options' and selecting different operators Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
926ad3c1a6
commit
cc970464ec
2 changed files with 16 additions and 1 deletions
|
@ -94,7 +94,11 @@
|
|||
<fieldset id="searchterms">
|
||||
<legend>Search for </legend>
|
||||
[% FOREACH search_box IN search_boxes_loop %]
|
||||
[% IF ( search_boxes_label ) %]<div style="text-indent: 4.5em;">[% ELSE %]<div>[% END %]
|
||||
[% IF ( search_boxes_label ) %]
|
||||
<div class="search_set" style="text-indent: 4.5em;">
|
||||
[% ELSE %]
|
||||
<div class="search_set">
|
||||
[% END %]
|
||||
[% IF ( expanded_options ) %]
|
||||
[% IF ( search_box.boolean ) %]
|
||||
<select name="op">
|
||||
|
|
|
@ -131,6 +131,17 @@ $.fn.selectTabByID = function (tabID) {
|
|||
/* Search results browsing */
|
||||
/* forms with action leading to search */
|
||||
$("form[action*='search.pl']").submit(function(){
|
||||
var removedPrior = false;
|
||||
$(".search_set").each(function(){
|
||||
if( removedPrior ){
|
||||
$(this).find('select[name="op"]').remove();
|
||||
removedPrior = false;
|
||||
}
|
||||
if( $(this).find('input[name="q"]').val() == "" ){
|
||||
$(this).remove();
|
||||
removedPrior = true;
|
||||
}
|
||||
});
|
||||
resetSearchContext();
|
||||
});
|
||||
/* any link to launch a search except navigation links */
|
||||
|
|
Loading…
Reference in a new issue