Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Nested Form Data #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Show Form
  • Loading branch information
ASPhillips8 committed Aug 8, 2024
commit 296c2a38b294cdb55dd1fc36b3a1a699a73f0b5b
3 changes: 3 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class App < Sinatra::Base
erb :root
end

get '/new' do
erb :'pirates/new'
end

end
end
25 changes: 24 additions & 1 deletion views/pirates/new.erb
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
<h1>Make your form here</h1>
<form action= '/pirates' method="post">
<h2>Pirate</h2>
<label>Name</label>
<input type="text" id="pirate_name" name="pirate[name]">
<label>Weigth</label>
<input type="text" id="pirate_weight" name="pirate[weight]">
<label>Height</label>
<input type="text" id="pirate_height" name="pirate[height]">
<h2>Ship 1</h2>
<label>Name</label>
<input type="text" id="ship_name_1" name="pirate[ships][][name]">
<label>Weigth</label>
<input type="text" id="ship_type_1" name="pirate[ships][][type]">
<label>Height</label>
<input type="text" id="ship_booty_1" name="pirate[ships][][booty]">
<h2>Ship 2</h2>
<label>Name</label>
<input type="text" id="ship_name_2" name="pirate[ships][][name]">
<label>Weigth</label>
<input type="text" id="ship_type_2" name="pirate[ships][][type]">
<label>Height</label>
<input type="text" id="ship_booty_2" name="pirate[ships][][booty]">

</form>