Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

-Changed how :value-set is declared (literal instead of being wrapped…

… in a list)

-Changed :value-set to accessor
-Modified test.lisp to match the changes
-Fixed reCaptcha rendering bug that dropped li and label elements
  • Loading branch information...
commit 50f43ef501700176acef6066a0fc76fdb447d358 1 parent 9894fed
ingram authored
Showing with 18 additions and 17 deletions.
  1. +1 −1  formlets.lisp
  2. +1 −1  macros.lisp
  3. +11 −10 recaptcha.lisp
  4. +5 −5 test.lisp
2  formlets.lisp
@@ -23,7 +23,7 @@
(defclass checkbox (formlet-field) ())
(defclass formlet-field-set (formlet-field)
- ((value-set :reader value-set :initarg :value-set :initform nil))
+ ((value-set :accessor value-set :initarg :value-set :initform nil))
(:documentation "This class is for fields that show the user a list of options"))
(defclass select (formlet-field-set) ())
(defclass radio-set (formlet-field-set) ())
2  macros.lisp
@@ -6,7 +6,7 @@
;; currently they use Hunchentoots' session (which is the main reason :formlets isn't portable)
(defun define-field (field-name field-type &key size value-set default-value validation)
"Takes a terse declaration and expands it into a make-instance for macro purposes"
- (let ((final-value-set (when value-set `(:value-set (list ,@value-set))))
+ (let ((final-value-set (when value-set `(:value-set ,value-set)))
(final-size (when size `(:size ,size))))
(multiple-value-bind (functions messages) (split-validation-list validation)
`(make-instance ',field-type :name ,(format nil "~(~a~)" field-name)
21 recaptcha.lisp
@@ -28,13 +28,14 @@
(declare (ignore v))
(:li :class (string-downcase (name field))
- (:script :type "text/javascript" :src (format nil "" *public-key*))
- (:noscript (:iframe :src (format nil "" *public-key*)
- :height "300" :width "500" :frameborder "0")
- (:br)
- (:textarea :name "recaptcha_challenge_field" :rows "3" :cols "40")
- (:input :type "hidden" :name "recaptcha_response_field" :value "manual_challenge"))
- (when error
- (htm (:span :class "formlet-error"
- (dolist (s error)
- (htm (:p (str s))))))))))
+ (:span :class "label"
+ (when error
+ (htm (:span :class "formlet-error"
+ (dolist (s error)
+ (htm (:p (str s)))))))
+ (:script :type "text/javascript" :src (format nil "" *public-key*))
+ (:noscript (:iframe :src (format nil "" *public-key*)
+ :height "300" :width "500" :frameborder "0")
+ (:br)
+ (:textarea :name "recaptcha_challenge_field" :rows "3" :cols "40")
+ (:input :type "hidden" :name "recaptcha_response_field" :value "manual_challenge"))))))
10 test.lisp
@@ -50,8 +50,8 @@
(define-formlet (test-form-two)
((one text :validation ((lambda (v) (> 6 (length v))) "You can't enter more than 5 characters here"))
(two file)
- (pull-down select :value-set ("one" "two" "three" "four"))
- (radio-set radio-set :value-set ("one" "two" "three" "four"))
+ (pull-down select :value-set (list "one" "two" "three" "four"))
+ (radio-set radio-set :value-set (list "one" "two" "three" "four"))
(password password)
(confirm-password password :validation ((same-as? "password") "You have to enter the same thing here and in the 'Password' field")))
(page-template (:title "Results TWO")
@@ -67,9 +67,9 @@
((pull-down multi-select
:value-set ("a" "b" "c" "d")
:validation ((lambda (val) (= 2 (length val))) "Please pick exactly two options"))
- (radio-set radio-set :value-set ("one" "two" "three" "four"))
+ (radio-set radio-set :value-set (list "one" "two" "three" "four"))
(single-check checkbox)
- (checking checkbox-set :value-set ("aye" "bee" "sea" "dee")))
+ (checking checkbox-set :value-set (list "aye" "bee" "sea" "dee")))
(page-template (:title "Results TWO")
(:h4 "Yay!")
(:p (str (write-to-string (post-parameters*))))
@@ -95,7 +95,7 @@
(one text :validation ((longer-than? 3) "It has to be longer than 3"))
(two textarea)
(three checkbox)
- (four checkbox-set :value-set ("one" "two" "three")))
+ (four checkbox-set :value-set (list "one" "two" "three")))
(page-template (:title "You got it")
(:p (str (write-to-string (post-parameters*))))))

0 comments on commit 50f43ef

Please sign in to comment.
Something went wrong with that request. Please try again.