Intro
Leaf v1.4.2 has introduced a new Leaf Form module which is the replacement for Simple Validation from v1.2.0 which was discontinued in v1.3.0. Leaf Form contains methods to handle input from the user...
To use Leaf Form, you simply have to import it:
Leaf Form Methods
sanitizeInput
sanitizeInput offers basic security for input data, i.e. sanitizing input against SQL injection.
isEmpty
isEmpty checks a field to see if it's empty. If it's empty, it adds an error to Leaf Form's errors. It takes in 3 parameters: the data to test, the name of that data and the error message if it's empty(optional).
isNull
isNull checks a field to see if it's null. If it's null, it adds an error to Leaf Form's errors. It takes in 3 parameters: the data to test, the name of that data and the error message if it's empty(optional).
returnErrors
Remember we talked about Leaf Form errors? Leaf Form holds errors for all failed tests, you get all these errors back with returnErrors