I'm using Commerce to sell tickets to an event and need to get the names of each person. I would like to do this via a Matrix field, showing fields based on the quantity selected.
I followed along with the new Sprigform tutorial, which covers part of it but it has an add button as opposed to a dropdown.
This is what I have so far, but on changing the select value the input field disappears, so maybe I'm just looping over things incorrectly?
{% set qty = qty ?? [['']] %}
<select sprig name="qty">
{% for i in range(1, 5) %}
<option value="{{ i }}" s-val:qty="{{ i }}" {{ qty == i ? 'selected' }}>{{ i }}</option>
{% endfor %}
</select>
{% for guest in qty %}
<input sprig type="text" name="options[guests[{{ loop.index0 }}][0]]">
{% endfor %}
Would appreciate any pointers!