On Fri, 09 Oct 2015 07:27:00 GMT, o3o wrote:

(...)

void postSettings(bool[] x) {

when I click submit the server freezes.

Thank you...

That's indeed a bug. The problem is that the two definitions for handling "array" and "boolean" parameters don't fit together. The rule for dynamic arrays is to continue to gather values until a certain index doesn't exist anymore in the submitted form. However, checkbox/boolean values are transmitted with "true === field is submitted" and "false === field is not submitted", so it's not possible to determine the end of the array unambiguously.

The question is if there is any meaningful way to express bool[] on the form level at all. If not, there should be a compile time error. An alternative is to add support for static arrays (bool[2]), which I did now with 92f4ae0.

Another possibility is to enable an alternative mode for dynamic array parameters, where the same field name can be used multiple times. The example could then look similar to this:

@multiField!"x"
void postSettings(string[] x)
{
// x is something like ["foo", "baz"]
}
form(action="settings", method="POST")
input(type="checkbox", name="x", value="foo")
input(type="checkbox", name="x", value="bar")
input(type="checkbox", name="x", value="baz")
button(type="submit") OK

Not sure if there is a more elegant way to enable that mode other than the attribute based solution above...