0

我希望能够处理使用动态数量的表单字段的表单

例如

(form :action "/theaction"
      :method "post"
      (input :type "text" :name "firstinput") (:br)
      (dotimes (i n)
         (:input :type "text" :name (FORMAT nil "INPUT~a" i)))
      (:input :type "submit" :value "submit" :name "submit"))

我如何将处理程序定义&rest为不被接受并且不允许我访问显然需要进一步处理的变量名。

(define-easy-handler (theaction :uri "/theaction") (&special-rest all-params)
   (log-message* :INFO "~a" all-params))

-> "(("firstinput" . "value") ("INPUT0" . "value") ("INPUT1" . "value") ...)"

一种可能性是预先定义所有变量,例如最多为 100,但这看起来相当麻烦且不直观。

4

1 回答 1

3

的 lambda-listdefine-easy-handler只是使用较低级别调用的快捷方式。您可以通过使用类似GET-PARAMETERPOST-PARAMETER. 您可以通过在处理程序主体中使用get-parameters*(或post-parameters* )来获取所有参数的列表。

于 2014-08-25T12:47:05.120 回答