I have integrated a search with JSF inside a view. This search has 2 search boxes and 2 search filters. The 2 filters contain the same elements. THis is done so the user can make search combinations. If the user wants to search he gives the input and clicks the search button. The search button executes a javascript function that makes API calls and takes the right data. What I want to do is prevent the user from selecting the same filter element on both of filters(For example if in the first filter "name" is chosen, this cannot be chosen at the second filter). I have tried something with itemDisabled but no luck until now...
Can someone help me, please?
Related
I am working on a search bar in the header. The search bar has 2 input fields, and to search through the products requires both values to be inputted (eg user is looking for a battery with 12volts and 10 amp/h).
The first input field (volts) will have a dropdown for the volts which will only have 4 different values to choose from. These values are already set within the metadata and when the user clicks inside the input field this dropdown will show up straight away with the 4 values to choose from.
The second input field however (amp/h), has a dropdown with about 30 values to choose from. I want this dropdown to be hidden until the user begins to type which value they are specifically searching for, then the dropdown will be visible with a reduced amount to choose from.
I have coded the first input field (volts), i just don't know how i can get the second one to be the way I have described above. I also am unsure how to make it actually search through the products based on the values the user inserts into input field based on what they click from dropdowns, but this can be sorted at a later date once functionality is sorted.
Any help will be greatly appreciated!
Using select2, is it possible to render the search input instead of clickable select with search input in the dropdown, so the user can focus it immediately with either clicking it or going down the form
with a TAB key?
Default:
What I (roughly) need:
My guess: it is more friendly to end-user, as it saves him/her a click.
Reading the docs and googling I did not find any out of the box solution and before implementing one myself I just want to make sure there isn't any.
I have a Typeahead.js project working, I am able to search. Within this I am pre-filling a second input (using an ID column).
I need a way to detect if the user goes back and alters the filled information but does not choose an item from the typeahead list so that I can clear this hidden field.
Example:
User types "project 1"
"My Project 1" is displayed as a suggestion and user selects suggestion.
Hidden field is set to ID of this item (1)
User returns to field, and types in "something else"
user does not select any suggestions presented
Currently there is no trigger supplied by Typeahead.js that presents me with the second scenario. Is there another way to detect this?
I need help and tips on how to implement this feature.
I have a search box. A correct search query could be: Cars in Paris. {category} in {location}.
When the user starts to type the first char a search hint appears for the categories.
The user selects "Car parts" from the hint options.
"[space-key]in[space-key]" are added to the searchbox automatically after the selection of an option.
A new search hint appears for the locations. User chooses Paris.
Do the search after selection the location.
Any tips on how to implement this?
Here's what I'd suggest:
Use jquery UI for auto suggest (very easy to implement, easy to customize to work for your specific situation) http://jqueryui.com/demos/autocomplete/. What I'd suggest is to have jQuery check whether the user is typing in a category or location (by seeing if the input is empty) and based on that, run a different autocomplete call.
jQuery UI has an event called 'select'. Use that to add the chosen item + in into the text field.
Now, when the user types in something else, have jQuery recognize that it's time for a location, and call jQuery UI autocompletion to suggest locations.
I'm trying to essentially create a drop down menu tied to a field that allows me to search multiple sections of the back end of a site by choosing which section to search using the drop down.
What this will entail is assigning a variable to represent the input from the form and scripting to toggle between the different query strings that that variable will be used to complete.
At this point I'm basically just lost as to how to structure the javascript required to accomplish this.
Can I tie each query string to each option using an id and then create a function that runs when the form itself is submitted, constructing the needed query URL by combining the variable with the base URL included in the javascript?
Basically I need, say, the text dropdown selection to tell the page that it will be appending %query% to http://example.com/content/text/?q= when the form is submitted and letting the system handle the rest.
I would sincerely appreciate some input on how to structure the js/jquery to accomplish that. I know I need to tie the variable to the field and the URLs to be completed to the drop down based on ID but I'm not totally sure how.
Here are some jsFiddle examples of what you might want to do:
Pass the search term and dropdown select field in the query string to one page and have the page do something based on the choices. jsFiddle
Pass the search term to a page specified by the dropdown select field. jsFiddle
Pass the search term to a URL specified by the dropdown select field. jsFiddle
This is what I would do.
Have a eventhandler for onsubmit
In YourMehtod(){
1. get dropdown selection
2. get the URL and append query string
3.window.open(url,"_self")
}