Skip to content

Flash and Slices #191

@adam-frisby

Description

@adam-frisby

I have a multi-select html form element which allows a user to select multiple categories. On form validation error, I would like to be able to reselect the categories the user had already selected.

Issues:

First, when calling FlashParams() with a slice parameter, the key becomes "slice[]", but when attempting to access the flash variable in a template via {{.slice[]}} results in "bad character U+005B '['"

Second, only the first value in the slice is set in the flash cookie. There is the limitation of flash being a string map, so the multiple values would have to be represented as a string. I was thinking you could escape backslashes and commas and use a comma separated list. This could be made into is own function that FlashParams() can call or can call when manually setting flash data. A template function would then be required to iterate over the comma separated list.

I think its a problem worth solving sooner or later. Any feedback would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions