I figured this out. Here is the step-by-step:
Through Fauxton
Navigate to: Databases -> [select your database name here] -> All Documents -> New Doc, then fill up the text area with your desired validation using the JSON boilerplate below and click Save:
{
"_id": "_design/my_validation_name",
"validate_doc_update": "function(newDoc, oldDoc, userCtx) {throw({forbidden : 'not able now!'});}"
}
Through curl
curl -X PUT http://127.0.0.1:5984/my_database/_design/my_validation_name -d '{"validate_doc_update": "function(newDoc, oldDoc, userCtx) { throw({forbidden: \"not able now!\" });}"}'
Important: The DocID must be prefixed by "_design/" and the key of the function must be "validate_doc_update". Note the function as string.
After the validation set, if we try to create a document you must see the error "not able now!"..
curl -X PUT http://127.0.0.1:5984/my_database/foo -d '{"foo" : "bar"}'
# {"error":"forbidden","reason":"not able now!"}