Arc Forumnew | comments | leaders | submitlogin
2 points by edw 6137 days ago | link | parent

    ;; Should be available at <http://poseur.com:8080/said>.
    ;;
    ;; Full source at <http://poseur.com/magic3/magic3.scm>.
    
    (define-handler (said)
      (send-xml!
       (form (message)
             '(((input type text name message))
               ((input type submit value "Go")))
             (send-xml!
              (link "click here" (send-xml! `(p you said: ,message)))))))
    
    ;; Start thusly: (spawn serve)


3 points by edw 6134 days ago | link

And now, because you guys worship brevity so...

    (define-handler (said)
      (send-xml
       (form (message)
             `(,(field message) ,(submit "Go"))
             (send-xml (link "click here" (send-xml `(p you said: ,message)))))))

-----

2 points by edw 6113 days ago | link

Now, slightly longer, but emits real XHTML and uses AJAX to place the result in the DOM:

    (define-handler (said)
      (page
       "Arc Challenge"
       (form (message)
             `(,(field message) ,(submit "Go"))
             (page "Almost"
                   (ajax-link "Click here" 'message
                              `(p "You said: " ,message))
                   `((div id message))))))

-----

2 points by edw 6112 days ago | link

Now, slightly shorter, more clear, is AJAXian from start to finish:

    (define-handler (said)
      (page
       "Arc Challenge"
       (ajax-form 'output (message)
                  `(,(field message) ,(submit "Go"))
                  `(p
                    ,(ajax-link "Click here" 'output
                                `(p "You said: " ,message))))
       '((div id output))))

-----