Hi, I am Kiru 👋 an indie hacker, a problem solver and vim-lover. I build projects to make the life of others and mine easier.

This page is intended to collect all my projects and some thoughts.

Empty multiselect is not set

TIL 28.06.2020

Having the following input:

<label for="cars">Make your choice:</label>
<select name="choice" id="choice" multiple>
  <option value="Yes">Volvo</option>
  <option value="No">Saab</option>
  <option value="Maybe">Saab</option>
</select>

If nothing is selected, the name of the property is not sent to the server (e.g. if you expect the full set to be sent to the server)

A hack to fix this is to add a hidden property with the same name.

<input type="hidden" name="myitems" value="" />

Learn more: