I have a form which contains 10 dropdown controls. Each control will be populated with the same 20 rows of data which are selected from a db table.
What I want to do is ensure that when the final choice is made there are no duplicates.
I could easily just do some error checking when I save the data, but maybe there is a slick way of hiding or graying out the items once they are chosen with javascript.
Has anyone done anything like this?
You could remove items from the other dropdowns when an item is selected in one. So other dropdowns want have that item for selection.
Related
I will try to explain shortly. I have this:
I am using AntDesign library with React, and these are not regular inputs, but Autocomplete dropdowns, when i focus on one of them it gives me a list of options to choose. So first i have to choose first dropdown value and after that i will get options in next one to choose, then i choose second and after that i get options for third and so on. So it is something like a chain, you must select all previous dropdowns to be able to get options and select current.
This is what i get from backend.
The normal thing would be that i get values for first dropdown and after i select value i call endpoint again which will return options for second one and so on. But no, i get all possible combination of values in one array, and now i have to filter that one big array each time i select value in one of the dropdowns, to get values for next one, so for the SCOPE for instance, i have to filter array depending on 3 selected previous values and so on for the others.
Last two fields are not important for this problem.
So, i need help how to filter these values in the easiest way. And to use Form.Item and Autocomplete from AntDesign.
I have a SQL datatable with 4 fields of info for a list of "Hazards":
ID
HazardName
DefaultInjury
DefaultSeverity
I have a form with 3 dropdowns (selections). The 1st 1 is filled in via AJAX with the ID and HazardName. The other 2 selections are filled with values and labels from other data tables.
What I want to do.. is when I select a hazard (on change) I want to set the 2nd selction with the DefaultInjury value and the 3rd selection with the DefaultSeverity value.
Is there an easy way to do this, such as having hidden extra values in the selections?
What I'm trying to avoid is having to use AJAX again to retrieve the values from the database again.
Thank you in advance for any help.
I'm using angular-materialize to generate a multiple select :
http://krescruz.github.io/angular-materialize/
I'm using ng-model to retrieve the selected items, all this works, however I tried to add a search box in order to filter what I need.
my problem is I search for the first time and check the value, but then when I make an other search (that doesn't lead to the previously selected item) it is deleted and I'm only left with the last selected items.
So my questions are :
1/ is there a way to conserve all the selected items even with multiple search?
2/ is it possible to always have the dropdown "active" meaning I won't have to click in order to have the list ? (if that helps the previous problem)
Thank you
i have a scenario in JSP where i have to make a combo with a list containing 10 items say 1,2,3.... 10. now i select a combo. I also need to provide an add button that will add another combo with same elements except the one being selected in previous combo.
eg- if 1st combo selected value is 1 then in the next combo i'll have the list as 2,3,4.....10 i.e, having 9 elements and so on. the user can add 10 combos like this, each combo having the items that haven't been previously selected.
can anyone help me with this???
thanks in advance :) !!!
just to clear things out, your scenario is that you have 10 combo boxes that contain values from 1 to 10... i suggest you can use a case statement, or multiple if statements, you can use javascript for that...
I have a table with a bunch of rows. In the last column of every row, there is a dropdown. When the dropdown changes, I need a new table row to appear below the row where the user selected the dropdown item. However, I also need the new row to have different data depending on what was selected in the dropdown.
Is any of this possible using only jQuery?
Note that I'm using ASP.NET for back-end development, so if a solution can be found without using ID's that would be great.
$("table select").live("click",function(){
var row=$(this).parent().parent();//add some .parent() untill you get the TR element
var val=$(this).val(); //<select> value if you want to use it for some conditions
$("<tr><td>....</td></tr>").insertAfter(row);
})
It's simple enough to add the HTML using JQuery. However, if you intend to save this data back to the server, the default ASP.NET process (using ViewState) will ignore the new rows. Instead, you would need to directly read the submitted form properties.
To learn how to add a row, look at the suggestions here: How to add a new row to a specified table with jQuery?