Version: v0.8.0 - Beta.  We welcome contributors & feedback.

Input.get

Input.get($fieldName, $ruleset='id') -> any

Description

Get an input value from the URL query string (i.e. via the HTTP GET method).

It will be validated per the given $ruleset. (See Input Validation)

If it does not pass validation, a default value will be returned for its type.

// URL:
// /results?sortBy=price&maxPrice=100

Input.get('sortBy')
//= 'price'

Input.get('discountCode')
//= ''  (default)

Input.get('maxPrice', 'i')
//= 100

Input.get('minPrice', 'i')
//= 0  (default for integer)

See Also