mbform.ss
(module mbform mzscheme
 (require (lib "servlet.ss" "web-server"))
 (provide mbform)

 (define (mbform gen)
   (define button-ht
     (make-hash-table))
   (define (add-button! fun)
     (define id (string->symbol (symbol->string (gensym))))
     (hash-table-put! button-ht id fun)
     (symbol->string id))
   (define (handle-submit req)
     (define bs (request-bindings req))
     (let/ec esc
       (hash-table-for-each
        button-ht
        (lambda (k v)
          (when (exists-binding? k bs)
            (esc (v req)))))
       (error 'mbform "Unknown submit button clicked!")))
   (gen handle-submit add-button!)))