I’m trying to create a simple sinatra app with one page containing a text area with a submit button underneath. Below that is another textarea that displays the modified text from the first textarea after the submit button is clicked.
Sinatra is new to me, so this is the best I can come up with so far:
CH.erb
<html>
<head>
<title>CH</title>
</head>
<body>
<div id="main">
<form action="" method="post">
<textarea id="orig" rows="25" cols="150"></textarea>
<br /><br /><br />
<button type="submit">Submit</button>
</form>
<br /><br /><br />
<textarea id="result" rows="25" cols="150"></textarea>
</div>
</body>
</html>
CH.rb
require 'sinatra'
get '/hi' do
erb :CH
end
post '/hi' do
# ????
end
Use this for your response route:
and modify your view like so:
I personally advocate Haml over Erb, but to each his/her own.