Arc Forumnew | comments | leaders | submitlogin
2 points by edw 4185 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 4182 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 4161 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 4160 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))))

-----