> For the complete documentation index, see [llms.txt](https://certil-remy.gitbook.io/learn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://certil-remy.gitbook.io/learn/sinatra/untitled-17.md).

# Sinatra Forms Lab

## Overview

In this lab, you'll practice building forms in Sinatra by creating a basketball team sign-up sheet. Your application will have a basic HTML form, and will display the data from the form after it has been submitted by the user.

## Instructions

1. Run `bundle install`
2. Run `shotgun`
3. Make a form

   Create a route that responds to a GET request at `/newteam`. Add a form to the `newteam.erb` template and render it in the GET `/newteam` route.

   The form should have fields for: Team name ('name') Coach ('coach') Point Guard ('pg') Shooting Guard ('sg') Power Forward ('pf') Small Forward ('sf') Center ('c')

It should look something like this:

[![form for basketball team](https://camo.githubusercontent.com/9799fd8320f3dcd34806217967f83b25aba8c8f8/68747470733a2f2f637572726963756c756d2d636f6e74656e742e73332e616d617a6f6e6177732e636f6d2f7765622d646576656c6f706d656e742f53696e617472612f6261736b657462616c6c2d666f726d2e706e67)](https://camo.githubusercontent.com/9799fd8320f3dcd34806217967f83b25aba8c8f8/68747470733a2f2f637572726963756c756d2d636f6e74656e742e73332e616d617a6f6e6177732e636f6d2f7765622d646576656c6f706d656e742f53696e617472612f6261736b657462616c6c2d666f726d2e706e67)

When creating your form, your "Submit" button will need to be identified by an `id` attribute with value of "Submit". We're telling this to you now because our test framework, Capybara, requires buttons to be [findable by an `id`, `title`, or `value` attribute](http://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FActions%3Aclick_button).

1. Handle form submission

   Create a route that responds to a POST request at `/team` Have the form send a POST request to this route. Upon submission, pass the submitted data to the `team.erb` template.
2. Final Output

   Update the `team.erb` template so when you post to this form, it displays the name of the team and each member of the team.

   Your view should display something like this:

   [![completed form](https://camo.githubusercontent.com/85cfe2db17b8140c5dfcdac0a40e4faac442dec4/68747470733a2f2f637572726963756c756d2d636f6e74656e742e73332e616d617a6f6e6177732e636f6d2f7765622d646576656c6f706d656e742f53696e617472612f6261736b657462616c6c2d726573756c74732e706e67)](https://camo.githubusercontent.com/85cfe2db17b8140c5dfcdac0a40e4faac442dec4/68747470733a2f2f637572726963756c756d2d636f6e74656e742e73332e616d617a6f6e6177732e636f6d2f7765622d646576656c6f706d656e742f53696e617472612f6261736b657462616c6c2d726573756c74732e706e67)
3. Deliverables

Pass the tests! Make sure you read the test output carefully!

## Resources

* [Ashley William's GitHub](https://github.com/ashleygwilliams/) - [Sinatra Form Party](https://github.com/ashleygwilliams/sinatra-form-party)
* [Ashley William's GitHub](https://github.com/ashleygwilliams/) - [Citibike Sinatra](https://github.com/ashleygwilliams/citibike-sinatra)

Clone this repo here: <https://github.com/learn-co-curriculum/basic-sinatra-forms-lab>
