Liking cljdoc? Tell your friends :D

noir.validation

Functions for validating input and setting string errors on fields. All fields are simply keys, meaning this can be a general error storage and retrieval mechanism for the lifetime of a single request. Errors are not persisted and are cleaned out at the end of the request.

Functions for validating input and setting string errors on fields. 
All fields are simply keys, meaning this can be a general error storage and 
retrieval mechanism for the lifetime of a single request. Errors are not 
persisted and are cleaned out at the end of the request.
raw docstring

*errors*clj

source

errors?clj

(errors? & field)

For all fields given return true if any field contains errors. If none of the fields contain errors, return false. If no fields are supplied return true if any errors exist.

For all fields given return true if any field contains errors. If none of the fields 
contain errors, return false. If no fields are supplied return true if any errors exist.
sourceraw docstring

get-errorsclj

(get-errors & [field])

Get the errors for the given field. This will return a vector of all error strings or nil.

Get the errors for the given field. This will return a vector of all error strings or nil.
sourceraw docstring

has-value?clj

(has-value? v)

Returns true if v is truthy and not an empty string.

Returns true if v is truthy and not an empty string.
sourceraw docstring

has-values?clj

(has-values? coll)

Returns true if all members of the collection has-value? This works on maps as well.

Returns true if all members of the collection has-value? This works on maps as well.
sourceraw docstring

is-email?clj

(is-email? v)

Returns true if v is an email address

Returns true if v is an email address
sourceraw docstring

max-length?clj

(max-length? v len)

Returns true if v is less than or equal to the given len

Returns true if v is less than or equal to the given len
sourceraw docstring

min-length?clj

(min-length? v len)

Returns true if v is greater than or equal to the given len

Returns true if v is greater than or equal to the given len
sourceraw docstring

not-nil?clj

(not-nil? v)

Returns true if v is not nil

Returns true if v is not nil
sourceraw docstring

on-errorclj

(on-error field func)

If the given field has an error, execute func and return its value

If the given field has an error, execute func and return its value
sourceraw docstring

ruleclj

(rule passed? [field error])

If the passed? condition is not met, add the error text to the given field: (rule (not-nil? username) [:username "Usernames must have a value."])

If the passed? condition is not met, add the error text to the given field:
(rule (not-nil? username) [:username "Usernames must have a value."])
sourceraw docstring

set-errorclj

(set-error field error)

Explicitly set an error for the given field. This can be used to create complex error cases, such as in a multi-step login process.

Explicitly set an error for the given field. This can be used to 
create complex error cases, such as in a multi-step login process.
sourceraw docstring

wrap-noir-validationclj

(wrap-noir-validation handler)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close