So I realized what my problem was (I accidentally had a ":persistp nil" in my form), so that problem is solved, and now my objects are persisting as they should. This is really nice =).
However, I still have my other questions (paragraphs 1 and 3). Thanks! Saikat On Feb 23, 6:13 pm, Saikat Chakrabarti <[email protected]> wrote: > An addendum to the below - I realized I wasn't specifying the class- > store field in the quickform. I have added that by using :class-store > (class-store 'person) in my make-quickform. I still have the same > problem, however. > > -Saikat > > On Feb 23, 1:34 pm, Saikat Chakrabarti <[email protected]> wrote: > > > Thanks Jan, that worked for me (mostly). Leslie, I see what you are > > saying about how it might be hacky to not be using a presentation/ > > parser, but it feels even more hacky to me to be conflating a lot of > > fields into a single presentation. In the case of the dual password, > > it seems fine to have a presentation that displays it as such, but > > what if I want to add a captcha to my registration view? The captcha > > doesn't have a corresponding slot in the model, but it would be used > > by my :satisfies function to make sure the registration is valid. I > > guess I don't see how by just creating a new presentation I could do > > this properly (i.e. which slot on the model does it make the most > > sense do add the captcha field on to?). Jan's approach makes more > > sense to me here, but just wondering what your thoughts are. > > > Jan, the reason I say mostly above is that I have now run into a > > different problem. I no longer get the error I was getting earlier > > (or any error for that matter), but my object is simply not getting > > created in the database. The code I have right now > > is:http://paste.lisp.org/display/76043. I have been able to create > > things in the database before (before this I had an :on-success method > > defined on my registration view that was writing out clsql syntax to > > create the user, and that was working), so I don't believe it's a > > connection issue. I realize that this is probably difficult for any > > of you to actually debug, just wondering if anyone has seen a problem > > like this before or if there is something obvious I am not doing. > > > Additionally, I have another form where I have a view mapped to a > > model that has float and integer fields. Whenever I tried to submit > > this form, however, I would get an error on all the integer and float > > fields saying that the value is invalid (even if I put in a number > > value into the field). I saw on another (old) post that the only way > > to make this work was to define a float/integer type and write a > > parser for the type. I managed to get around it for now by defining a > > writer on each of those fields that just assigns the value to the slot > > of the model, but this seems a bit hacky (maybe not - just seems like > > it should be done more automatically). Is the proper way to do this > > still to define parsers for float/integer types? > > > Thanks a lot for all your help! > > > -Saikat > > > On Feb 23, 2:06 am, Jan Rychter <[email protected]> wrote: > > > > 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 -~----------~----~----~----~------~----~------~--~---
