Paste: changed validation-failed?
Author: | middayc |
Mode: | factor |
Date: | Mon, 29 Dec 2008 00:51:03 |
Plain Text |
SYMBOL: on-validation-fail
: validation-failed ( -- * )
on-validation-fail get dup [ call ] [ drop
post-request? revalidate-url and [
begin-conversation
nested-forms-key param " " split harvest nested-forms cset
form get form cset
<continue-conversation>
] [ <400> ] if*
] if exit-with ;
... create-validation-rules validate-params ...
... create-validation-rules validate-with-json ...
: ?get-validation-error-message ( val -- msg? )
dup class \ validation-error eq? [ message>> ] [ drop f ] if ;
: get-validation-errors ( form -- errors )
values>> [ ?get-validation-error-message ] assoc-map ;
: validate-with-json ( validators -- )
[ [ form get get-validation-errors >json <content-json> ] on-validation-fail set
validate-params ] with-scope ;
New Annotation