Javascript disabled and navigation widget

19 views
Skip to first unread message

Fred

unread,
Dec 22, 2012, 9:41:07 AM12/22/12
to webl...@googlegroups.com
Hello,

when i disable javascript in my browser, delete operation fails in gridedit widget
if the widget is part of a navigation widget.

Here is a simple example :

(in-package :test-no-ajax)

;; Define callback function to initialize new sessions
(defun init-user-session (root)
  (setf (widget-children root)
(list (make-widget #'(lambda (&rest args)
      (with-html
(:strong "Happy Hacking!"))))
     (make-page))))

(defclass foobar ()
  ((id :accessor foobar-id)
   (name :accessor foobar-name
:initform nil
:initargs :name)))

(defview foobar-view (:type table :inherit-from '(:scaffold foobar))
  (id :hidep t))

(defview foobar-form-view (:type form :inherit-from '(:scaffold foobar))
  (id :hidep t))

(defun make-page ()
  (make-navigation 'Menu
  (list "Start" (make-widget #'(lambda (&rest args)
   (with-html
     (:strong "Root URL!")))))
  (list "Foo" (make-instance 'gridedit
:name 'test-no-ajax
:data-class 'foobar
:view 'foobar-view
:item-form-view 'foobar-form-view))))


When javascript is disabled, in the "Foo" page, i  can add items, but if i try to delete some item(s),
the brower send me a blank error page with the following message :

Resource /foobar not found

URL is :


When javascript is enabled, delete action succeed.

Maybe it's not important, 
but i do not experience weblocks in order to say it.

Any suggestion ?

Thanks

Regards.


Willem Rein Oudshoorn

unread,
Dec 23, 2012, 10:07:57 AM12/23/12
to webl...@googlegroups.com
Fred <iri...@gmail.com> writes:

> Hello,
>
> when i disable javascript in my browser, delete operation fails in gridedit
> widget
> if the widget is part of a navigation widget.

Indeed this is a problem. I remember that this problem was reported
before but I cannot find the relevant message back.

As far as I remember the problem is that the call

(do-modal ...)

which is used to display the confirmation screen ('Are you sure you want
to delete this item' or something similar)
does not work well with the selection widget.
If you reload the page with the /foo... part removed you see suddenly
the confirmation dialog.

The core of the problem is that when it wants to show the model dialog
it replaces temporarily the whole widget tree with the 'dialog' widget.
However the url still tries to select the /foo pane.
The general code will now throw a fit becauset that pane is gone.

A quick way to fix this is by clearing the *uri-tokens* so that the
handler does not complain about missing resources. (see below)

However this might have unwanted side effects, and I haven't thought
about it enough to know what the correct solution will look like.

Wim Oudshoorn.


diff --git a/src/control-flow/call-answer.lisp b/src/control-flow/call-answer.lisp
index ecc6523..a29d025 100644
--- a/src/control-flow/call-answer.lisp
+++ b/src/control-flow/call-answer.lisp
@@ -125,6 +125,7 @@ for styling purposes."
(lambda (new-callee)
(lambda (&rest args)
(declare (ignore args))
+ (setf (remaining-tokens *uri-tokens*) nil)
(with-html
(:div :class "modal"
(:h1 (:span (str title)))




Fred

unread,
Dec 24, 2012, 5:15:17 AM12/24/12
to webl...@googlegroups.com, woud...@xs4all.nl
Thanks for your answer.

I hope it will help for further developments.

Regards.
Reply all
Reply to author
Forward
0 new messages