When submitting search, check for values left in the tag boxes.

I found pretty commonly that it was easy to leave some text in the
box and forget to press enter, so that tag never got added to the
actual search.
This commit is contained in:
voussoir 2020-04-02 17:11:29 -07:00
parent 7fc4604025
commit 89c308c4a4

View file

@ -507,6 +507,14 @@ function submit_search()
*/
var url = window.location.origin + "/search";
var parameters = [];
// If the user has left any text in the tag boxes, but not hit Enter on
// them, then they will not be in the `inputted_` lists and would get
// ignored. So let's run through each of their hooks to get them all saved.
add_searchtag_from_box(input_musts, inputted_musts, "search_builder_musts_inputted");
add_searchtag_from_box(input_mays, inputted_mays, "search_builder_mays_inputted");
add_searchtag_from_box(input_forbids, inputted_forbids, "search_builder_forbids_inputted");
var has_tag_params = false;
var musts = simplify_tagnames(inputted_musts).join(",");
if (musts) {parameters.push("tag_musts=" + musts); has_tag_params=true;}