# TooBasic: Forms Builder
## What is Forms Builder?
_Forms Builder_ is an internal mechanism of __TooBasic__ that allows to specify
HTML forms a JSON configuration.
The main idea in it is to create single specification for certain form and be able
to show it in more than one mode.
For example, if create a form to display an item in the database, other to edit
it, other when you have to remove it and another to create a new item, the first
thing you'll notice is that it is the same form where the only change is it's
behavior and maybe how many buttons it has at the end.
For those cases, _Forms Builder_ provides a way to specify fields once and some
specific properties depending on how the form should be built.
Before we start using _Form Builder_, let's think an example to work with.
Let's suppose you created a table in your system called `rooms` and it's
representation artifacts (_item-reprensentation_ and _items-factory_) representing
some part of some house.
Also you created these controllers (along with it's and views):
* `rooms`: To list all rooms.
* `room`: To show a room.
* `room_create`: To create a new room.
* `room_edit`: To modify a room.
* `room_delete`: To destroy a room.
Now let's say that you table `rooms` has these fields:
* `description`: a long text.
* `status`: Possible values are:
Now, _what would be the problem here?_
Let's say you want to use a single form definition for all your room controllers
(except controller `rooms`) and then invoke it inside your view.
The next sections will guide you in how to do such a thing.
This example will be built step by step so you can see how to create a complete
form with its details using commands.
But that can be a little tedious, so, if you simply want to create a basic form,
[this link](tech/qforms.md) may be of more use.
## Using forms
### Creating a form
the first thing to do is to create an initial definition for our form and for that
we're going to run this command:
$ php shell.php sys forms create table_rooms
This command will generate a new _Forms Builder_ specification file at
`ROOTDIR/site/forms/table_rooms.json` with some basic structure (not yet useful).
We won't go into specifics regarding the actual configuration, for that you can
click [this link](tech/forms.md) and get more information about it.
### Form name
Something we suggest you to set is the form's name, this simple property will be
used as form ID when building a HTML version and also in it's inputs IDs.
If you want you can omit this step because the previous one already used the file
name to set this property, but if you want to change it you can run this command
(it won't change the file name):
$ php shell.php sys forms --set-name my_form --form table_rooms
From now on, will assume you've run this command.
### Form action and method
By default all your form are going to be sent to `#` (same page) and they will use
`GET` as sending method, but you can change this using commands like this:
$ php shell.php sys forms --set-action '?action=someaction' --form table_rooms
$ php shell.php sys forms --set-method 'post' --form table_rooms
This will get you something like this: