Closed
Description
Hey I have the following code:
<input type="checkbox" name="colors" value="red">Red
<input type="checkbox" name="colors" value="green">Green
<input type="checkbox" name="colors" value="blue">Blue
<input type="checkbox" name="colors" value="black">Black
<input type="checkbox" name="colors" value="white">White
What is the correct way to bind them (using Bind Middleware) to obtain all data from them? I'm binding to an string but I only get the first one, if I bind to a slice I get an error.
Any ideas? Does Bind support this?
This is done in other languages by naming the group as an array:
<input type="checkbox" name="colors[]" value="purple">Purple
Then my struct will have a slice to bind. But I can't seem to make it work here.