fukamachi / caveman

Lightweight web application framework for Common Lisp.
http://8arrow.org/caveman/
782 stars 63 forks source link

How to deal with checkbox items in params? #24

Closed vityok closed 10 years ago

vityok commented 10 years ago

I think that eventually I will figure it out, but it would be nice to have this information in the documentation/tutorial: what is the proper way to get a list of selected checkboxes?

for example, if I've got two checkboxes named "item-id" selected in a form, then the params list will be:

  (:|item-id| 1 :|item-id| 2)

however, getf will return only one of the selected items:

(getf params :|item-id|) => 1

It would be great to have a default way to access these values as a list described in the documentation.

fukamachi commented 10 years ago

You can use getf-all of "multival-plist" for that.

vityok commented 10 years ago

Hi Eitarow, thanks for the tip!

Since input type checkbox are a common feature occurring in HTML forms, would you please consider adding a corresponding tip to the documentation and probably a multival-plist dependency to the project skeleton so that it would be possible by default to access these items? I am sure that newcomers would be glad to have this.

Thanks!

fukamachi commented 10 years ago

Yeah, you're right. I'm going to add it.

vityok commented 10 years ago

Information now available on the project readme page. Resolinvg/closing the issue.

Thanks!