> the javascript part and I am not sure I understand fully how to use
> the dataview with forms. Specifically I was thinking of implementing a
> simple contact me form which would save the info in a database but
> only after it has sent me an email.
Is your requirement that the object only be saved *if* the email was
successfully sent? Not sure what you intend here.
Here is an example of a dataform being built on a grid drilldown with
post-processing (ignore some of the cruft):
(defmethod dataedit-create-drilldown-widget ((grid rubrica-grid) (item
lagru-rami))
;(temporary-hide-return grid)
(let* ((a-composite (make-instance 'composite))
(info-form (make-instance 'davide-form
:editable-p t
:data item
:ui-state :form
:allow-close-p t
:on-close (f_% )
:form-view 'normal-rami-view.form
:ui-state :form
#+nomore :buttons-render-fn
#+nomore (f_ (render-link
(lambda/cc (&rest
args)
(with-flow _
(yield
(wrap-in-fake-form future-percents))))
"Modifica
provvigioni"
:class "button
lagru-modify pencil"))
:on-success (f_%
(if
(prepare/send-email "[email protected]"
"[email protected]" :subject "subject" :body "body")
(progn
(push-end (saved-rami-of (the-user)) item)
(persist-object *default-store* item))
(lagru-grid-reset-state grid))
:on-cancel (f_%
(lagru-grid-reset-state grid)))))
(push info-form (composite-widgets a-composite))
a-composite))
The problem with the above is if prepare/send tries to actually send
an email and fails. I batch emails, so the above code is safe.
> it seems that the dataform will do Creation in the database but it
> does not seem that I can force to do some processing before or after.
As I understand it, the object can exist before the DF is closed/
saved, the save action only triggers the DF writing values in the html-
form into the object slots using the view mechanism (writers etc).
I usually persist objects explicitly (probably unnecessary) but more
often tack on successfully-saved objects into object lists. Eg an
Employee may have a list of vacation-requests, a DF that creates a new
vacation request would almost always, push this object onto that
list.
But then I use CL-persistence exclusively, and I don't know if your
question has different answers depending on the storage back-end
you're using..
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---