Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>JS fiddle solution:</p> <p><a href="http://jsfiddle.net/ZjhWV/1/" rel="nofollow">http://jsfiddle.net/ZjhWV/1/</a></p> <p>Not the best solution, but working one. Make a some list of text contents from first select and link them with available options from second one. </p> <p>I used textContent from first one and linked it with option values from second one. But you can make link based on different property of the option (id, value, text content... ).</p> <p>You can get text content from currently selected option with <code>this.options[this.selectedIndex].textContent</code>.</p> <p>PS: In case that array is empty, all options are available...</p> <p>javascript:</p> <pre><code> var subselectContains = { "Damage": [1, 3, 5], "Calibration Failure": [], "Component Failure": [2], "Customer Request": [], "Error on Potted SUT": [1], "Installation Error": [], "Interference": [], "Network Issue": [], "No Fault Found": [], "No Power/Fuse Blown": [], "Non-AMCS Issue": [], "OBC HW Issue": [], "OBC SW Issue": [], "Training Issue": [], "Truck Not Available": [], "Routine Maintenance": [] }; var failureReson = $("#failureReason"); var solutionOptions = $("#solutionId option"); failureReson.change(function () { var visibleOptions = subselectContains[this.options[this.selectedIndex].textContent]; if (visibleOptions.length != 0) { solutionOptions.hide(); solutionOptions.each(function () { for (var i = 0; i &lt;= visibleOptions.length; i++) { if (this.value == visibleOptions[i]) { $(this).show(); } } }); } else { solutionOptions.show(); } }); </code></pre> <p><strong>EDIT:</strong> My solution is just a short version. It works only when you change first select and it doesn't affect the currently selected option. But I'm sure you can solve this on your own ;) </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload