mtravers / wuwei

WuWei -- effortless Ajax web UIs from Common Lisp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

:after clause in remote-function

bahollis opened this issue · comments

The :after clause in remote-function does not execute on the client side when in-function? is true due to the return statement being inserted between the ajax request and the :after clause. would this not make more sense:

(let ((result
       (format nil "new Ajax.Request('~A', ~A); "
               url
               (json-options `(:asynchronous t
                                             :parameters ,(if form
                                                              `(:raw ,(format nil "Form.serialize(~A)"
                                    (if (stringp form)
                                        (format nil "document.getElementById('~A')" form)
                                        "this")))
                                                            (json-options-transform params))
                                           ,@(if complete `("onComplete" (:raw ,(format nil "function(request){~A}" complete))))
                                           ,@(if success `("onSuccess" (:raw ,(format nil "function(request){~A}" success))))
                                           ,@(if failure `("onFailure" (:raw ,(format nil "function(request){~A}" failure))))
                                           ,@(if eval-scripts? `("evalScripts" t))
                                           )))))

(when before (setf result (string+ before result)))
(when after (setf result (string+ result after)))
(when confirm (setf result (format nil "if (confirm('~A')) { ~A };" confirm result)))
(when stop-propagation?
  (setf result (format nil "~A Event.stop(event);"  result)))

(when in-function? (setf result (string+ result " return false;")))

result)