Saikat Chakrabarti <[email protected]> writes:
> I am trying to create a user registration form that has a "Retype
> Password" field in the view (which does not map to the model's slot).
> I would like to use the built in functionality in Weblocks to create a
> new user through this registration form (without defining my own
> method for on-success and writing my own CLSQL, if possible).
Here's what I do, it uses the form-level validator support that I
implemented in Weblocks a long time ago and :reader/:writer view
arguments:
(defview user-registration-form (:type form
[...]
:satisfies
(lambda (&key password password2
&allow-other-keys)
(if (string-equal password password2)
t
(values nil "Passwords do not
match."))))
(password :present-as (password :max-length 128) :label "Password"
:writer (lambda (pwd obj)
(setf (slot-value obj 'password)
(hash-password pwd)))
:requiredp t)
(password2 :present-as (password :max-length 128) :label "Password (again)"
:reader (lambda (&rest args) (declare (ignore args)) "")
:writer (lambda (&rest args) (declare (ignore args)))
:requiredp t)
The 'user' data object only has a 'password' field, of course.
--J.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---