Arc Forumnew | comments | leaders | submitlogin
3 points by edw 6133 days ago | link | parent

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 6112 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 6111 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))))

-----