Hi and welcome,
> 1. How are widget and view different? When should I use each? Is it
> possible to mix widgets into a view (especially a form view) and vice
> versa?
Views are not as flexible as we would like them to be.
Personally I use custom HTML instead of data and table views,
and a new form widget I wrote (that can be initialized
from a form view if desired) for forms.
> 2. If I have something like:
> (defwidget list-mk () ((list-so-far ...)))
>
> (defmethod render-widget-body ((widget list-mk) &rest args)
> (with-html (:input :type "string" :id "input-string")
> (render-link (lambda (&rest arg) ...)
> "add element to list")))
> How can I get the value of the string from the input?
with-html-form comes in handy (with corrections to your HTML
as well):
(defmethod render-widget-body ((widget list-mk) &rest args)
(with-html-form (:POST (lambda (&key the-string &allow-other-keys)
(format t "Adding string: ~S~%" the-string)
(push the-string (slot-value widget 'list-so-far)))
(:input :type "text" :name "the-string")
(:input :type "submit" :value "Add to list")))
Untested, and please forgive me any mismatched parens;
nesting of forms should be unambiguous through the indent
in any case.
Leslie
--
You received this message because you are subscribed to the Google Groups
"weblocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/weblocks?hl=en.