# Pick the right input type for an action

> Choose types for input, params, query and output definitions, including conversions and rejected values.

Framework: total5
Product: Total.js 5 (total5@0.0.19)
Language: en
Content-SHA256: 94e8b431828404458a5dd183a56f8114ec936a5e5936d5487639090ed99358f4
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: total5-installed@total5@0.0.19
Review: not-recorded

The `input` of an action is a list of `name:Type` fields separated by commas. A `*` before the name makes the field required. Besides validating, many types **convert** the value, so the action receives clean data:

| Type | Result |
|---|---|
| `String`, `Number`, `Boolean`, `Date`, `Object`, `Array` | the basic types (strings are trimmed, numbers and dates are parsed) |
| `Email`, `Phone`, `URL`, `UID`, `GUID`, `Base64`, `Color`, `Zip` | validated formats |
| `Lowercase`, `Uppercase`, `Capitalize`, `Capitalize2`, `Name` | text converted to that style: `Capitalize` capitalizes every word, `Capitalize2` only the first letter of the text and lowercases the rest |

```js definitions/types.js
NEWACTION('Types/exec', {
	name: 'Typed input',
	input: '*email:Email, age:Number, active:Boolean, nick:Lowercase, code:Uppercase, title:Capitalize, sentence:Capitalize2, site:URL',
	action: function($, model) {
		$.callback(model);
	}
});
```

```js controllers/types.js
exports.install = function() {
	ROUTE('POST /types/ --> *Types/exec');
};
```
