I have a multi select field in a complex form. It's works on the Magic Forms. But Magic Forms only handle multi select's values last one.
<select required multiple id="..." name="...">
<option value="HTML">
HTML
</option>
<option value="CSS">
CSS
</option>
<option value="JavaScript">
JavaScript
</option>
<option value="Node.js">
Node.js
</option>
</select>
If I select HTML & CSS options, Magic Forms handle and record only the CSS option. I searched little bit, but I can't it. Is there a method?
It's possible you just need to make minor adjustments with the select name
.
Ref : Multiselect in OctoberCMS Magic Form
As when you select multiple items it becomes an array
. to represent the array on the HTML side you need to add []
square braces to the name.
Suppose your current select name is
tech
So your select name becomestech[]
as now we are representing multiple values so it becomesan array
.
<select required multiple id="tech" name="tech[]">
<!-- USE name like THIS ^ -->
<option value="HTML">
HTML
</option>
<option value="CSS">
CSS
</option>
<option value="JavaScript">
JavaScript
</option>
<option value="Node.js">
Node.js
</option>
</select>
It will work and in backend records, it will show something like this :
If any doubt please comment.