Anonymous avatar Anonymous committed c9bd02e

contrib/lpolzer (form-widget): added funcall-field-widget, plus some minor fixes.

Comments (0)

Files changed (1)

contrib/lpolzer/form-widget.lisp

           dropdown-field-widget
           choices-of
 
+          funcall-field-widget
+
           field-presentation->field-widget-class
           field-parser->field-widget-parser
           field-widget-from-field-info
     (:input :type "submit" :value "Submit")))
 
 (defmethod handle-form-submission ((widget form-widget) &rest args)
+  (declare (ignorable args))
   #+leslie(format t "submit with args: ~S~%" args)
   (let* ((fields (fields-of widget))
          (field-results (mapcar (lambda (field)
                                          (welcome-name-of widget))
                          :frob-welcome-name nil
                          :selected-value (intermediate-value-of widget)
-                         :class (if (error-message-of field) "invalid" "valid")
+                         :class (if (error-message-of widget) "invalid" "valid")
                          :id id))
       (:radio
         ;; TODO
  #<STANDARD-CLASS INPUT-PRESENTATION>)
 |#
 
+;; funcall field
+(define-widget funcall-field-widget (field-widget)
+  ((function :type (or symbol function))))
+
+(defmethod render-field-contents ((form form-widget) (field funcall-field-widget) &key id &allow-other-keys)
+  (funcall (function-of field) form field))
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.