[hunchentoot-devel] form validation
Eric Abrahamsen
girzel at gmail.com
Fri Aug 28 01:04:13 UTC 2009
Thanks to both of you. I've got weblocks and am poking through the
code to see what's possible. Ala'a, what you sketched there is pretty
close to what I had in mind, though I'm thinking one could define a
suite of validators, for a set of form inputs, and get the validated
and possible converted values out as a single structure. I'll go putter.
Thanks,
Eric
On Aug 27, 2009, at 6:30 PM, Ala'a (cmo-0) wrote:
> One possible way is to define your own protocol:
>
> (add-validation validation-forms "error message")
>
> (valid-p object) returning two values, Boolean representing validity
> after applying all validation rules. otherwise returning nil and the
> second
> value holding errors if they exists. then you can use it with
> multiple-value-bind
>
> (multiple-value-bind (valid-p errors) (validate object)
> (if valid-p
> (save object) ; persist it
> (otherwise report back the errors to the user))
>
>
> this is only a sketch, you may use any thing else that suits your
> requirements.
>
> regards,
>
> Ala'a (cmo-0)
>
>
>
> On Thu, Aug 27, 2009 at 12:26 PM, Eric Abrahamsen<girzel at gmail.com>
> wrote:
>> define-easy-handler has some pretty extensive features for accepting
>> GET/POST parameters, but when it comes to validating those
>> parameters,
>> and possibly returning errors to the client, it seems like the only
>> viable thing to do is write a standard handler function and work with
>> get-parameters* and post-parameters* directly.
>>
>> Does anyone have any experience to share in this direction? How is
>> everyone handling more complex form validation and error reporting?
>> Has there ever been any talk of a small external library for doing
>> validation?
>>
>> Eric
>>
>> _______________________________________________
>> tbnl-devel site list
>> tbnl-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>>
>
>
>
> --
> It does not matter how fast your code is, if it does not work!
>
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
More information about the Tbnl-devel
mailing list