Andy,

thanks for quick feedback. Details you requested see below.

Am 11.04.2008 um 17:11 schrieb Andy Chambers:
On Fri, Apr 11, 2008 at 2:51 PM, Frank Goenninger <[EMAIL PROTECTED]> wrote:
Andy,

Symptoms:

1. No updates received from Web browser
2. When trying to update a slot on a page model I do not get any update of
the Web page ...

Is the git repo somehow in an "intermediate state" ? - I seem to remember
you saying so in some email.
Appreciate your feedback.

I thought that what I pushed last night would have worked but Kenny
seems to be having problems too.  What's your platform?

Mac OS X 10.5.2

 Do you have
firebug running?  Maybe there's some javascript errors that could give
us a clue.

Firebug is running. Does not show javascript errors.

I'll load your example up and take a closer look when I get home this evening.

Thanks!



In the meantime, can you post the output of "git show"

Sure:

1.) Did a git fetch again to make sure I have latest sources.
2.) Git show produces:

commit 4a0795cb335d226c51c61e82edc342d01e26e14d
Author: Andy Chambers <Andy Chambers [EMAIL PROTECTED]>
Date:   Tue Apr 8 22:59:09 2008 +0100

    added high-level macro to help making checkboxes

diff --git a/example.lisp b/example.lisp
index 2f6b2d9..030f7d3 100755
--- a/example.lisp
+++ b/example.lisp
@@ -57,17 +57,28 @@ See the Lisp Lesser GNU Public License for more details.
 (progn
(declaim (optimize (debug 3) (speed 0) (safety 1) (compilation- speed 0))))

+(defmd web-checkbox (page)
+  (status (c? (param? "STATUS")))
+  (kids (c? (the-kids
+            (mk-div ()
+              (mk-form (:action "get")
+                (mk-checkbox "Status: " status)
+                (mk-div ()
+                  (mk-text (status (u^ web-checkbox))))))))))
+
 (defmd web-apropos (page)
   (term (c? (param? "term")))
   (pkg (c? (param? "pkg")))
-  (exports-onlyp (c? (param? "exports-onlyp")))
+  (exported-only-p (c? (let ((rslt (param? "EXPORTED-ONLY-P")))
+                        (trc "exported" rslt)
+                        rslt)))
   (filter (c? (param? "filter")))
   (result (c? (progn
- (trc "calculating result" (^term) (^pkg) (^exports- onlyp) (^filter)) + (trc "calculating result" (^term) (^pkg) (^exported- only-p) (^filter)
)
                (bwhen (search (^term))
                  (apropos-list search
                                (^pkg)
-                               (^exports-onlyp))))))
+                               (^exported-only-p))))))
   (title "Lisp Apropos")
   (style "style.css")
   (kids (c? (the-kids
@@ -79,6 +90,10 @@ See the Lisp Lesser GNU Public License for more details.
                                  :-type "text"
                                  :value (c? (term (u^ web-apropos)))))

+                (mk-checkbox "Exported: " exported-only-p)
+
+                (mk-text (c? (exported-only-p (u^ web-apropos))))
+
                 (mk-div (:id :result)
                   (mk-ul ()
                     (list
@@ -244,6 +259,7 @@ See the Lisp Lesser GNU Public License for more details.
   (setf *catch-errors-p* nil
        *dispatch-table*
        (list
+        (test-page "/check-test" 'web-checkbox)
         (test-page "/apropos" 'web-apropos)
         (create-folder-dispatcher-and-handler "/js/"
"/home/andy/asdf/ hunchncells/js/"))))
diff --git a/forms.lisp b/forms.lisp
index 4f64383..5b73012 100755
--- a/forms.lisp
+++ b/forms.lisp
@@ -21,6 +21,8 @@ See the Lisp Lesser GNU Public License for more details.
 (progn
(declaim (optimize (debug 3) (speed 0) (safety 1) (compilation- speed 0))))

+;;; Vanilla HTML
+
 (defhtml form ()
     ()
   (:attrs form
@@ -63,3 +65,18 @@ See the Lisp Lesser GNU Public License for more details.
   (:attrs button
    :name :value (:-type :type)
    :disabled :tabindex :accesskey :onfocus :onblur))
+
+
+;;; Higher Level Widgets
+
+(defmacro mk-checkbox (label attribute &key top-args label-args input- args)
+ `(mk-div (,@top-args)
+    (mk-label (,@label-args :for ,(symbol-name attribute))
+      ,label)
+    (mk-input (,@input-args
+ :name ,(symbol-name attribute) :id ,(symbol-name attribute)
+               :-type "checkbox"
+               :checked (c? (,attribute (u^ page))) ; parameterize?
+               :value (c? (if (,attribute (u^ page))
+                             "on"
+                             "off"))))))
diff --git a/js/openair.js b/js/openair.js
index d753879..c2e5c7f 100644
--- a/js/openair.js
+++ b/js/openair.js
@@ -6,7 +6,16 @@ function recv (data) {
     }
 }

-function send (obj, e) {
+function send_checkbox (obj, e) {
+  var request = {};
+  var msg = obj.checked ? "on": "off";
+  request[obj.id] = msg;
+  $.get(location.href + "/" + obj.id,
+       request,
+       recv);
+}
+
+function send_text (obj, e) {
   var request = {};
   switch(e.type) {
     case "keyup":
@@ -29,8 +38,11 @@ $(document).ready(function(){
 //     $(":input").keyup(function(e) {
 //     send(this, e);
 //     });
-    $(":input").change(function(e) {
-      send(this, e);
+    $(":input[type='text'").change(function(e) {
+      send_text(this, e);
+                      });
+    $(":input[type='checkbox']").change(function(e) {
+      send_checkbox(this, e);
     });
 });

Oh - now I see the potential problem: These "//" ... I will test...

Best,
  Frank


Cheers,
Andy
_______________________________________________
cells-devel site list
[email protected]
http://common-lisp.net/mailman/listinfo/cells-devel

_______________________________________________
cells-devel site list
[email protected]
http://common-lisp.net/mailman/listinfo/cells-devel

Reply via email to