'What is the best way to handle several combinations to output a result?
Let's suppose I have an application with 4 different dropdowns
<select name="colors" id="colors">
<option value="Red">Red</option>
<option value="Blue">Blue</option>
<option value="Green">Green</option>
</select>
<select name="numbers" id="numbers">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<select name="names" id="names">
<option value="axel">axel</option>
<option value="maria">maria</option>
<option value="john">john</option>
<option value="richard">richard</option>
</select>
<select name="status" id="status">
<option value="eligible">eligible</option>
<option value="not_eligible">not eligible</option>
</select>
<button>send</button>
<div>fortune: ??</div>
And whenever I hit send, I'm sending to the backend all the selected information. Every possible combination has a logic to retrieve a "fortune". For example, if I select the combination red-1-axel-eligible, I need to perform some sort of logic, that may or may not be the same as another possible combination.
It's there some design pattern or at least a clean way to handle this scenario, and don't end up with an unscalable solution?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
