まず、問題のHTMLファイルをまず記述します。
html
1<!DOCTYPE html> 2<html lang="ja"> 3<head><meta charset="utf-8"> 4</head> 5<body> 6<header> 7<h1 id="num1">Hello</h1> 8</header> 9<main> 10<form action="main.html" method="post"> 11<h1>ログイン画面</h1> 12<input type="text" name="name" placeholder="姓" required="true"> 13<input type="text" name="name" placeholder="名" required="true"><br> 14<input id="num2" type="tel" name="tel" placeholder="携帯電話番号" required="true"><br> 15<input id ="num3"type="password" name="password" placeholder="パスワード"><br> 16<input type="submit" value="送信"> 17<input type="reset" value="リセット"> 18</form> 19</main> 20</body> 21</html>
送信ボタンを押したら、formタグのactionのURLに移動できるようにしたいです。お願いします。
(例)main.htmlのようにすると、次のようなエラーが発生しました。
Routing Error
No route matches [POST] "/main.html"
Rails.root: C:/Users/user/GROSS
Application Trace | Framework Trace | Full Trace
Routes
Routes match in priority from top to bottom
Helper HTTP Verb Path Controller#Action
Path / Url
Path Match
users1_path GET /users1(.:format)
users1#index
users1_new_path GET /users1/new(.:format)
users1#new
rails_service_blob_path GET /rails/active_storage/blobs/:signed_id/*filename(.:format)
active_storage/blobs#show
rails_blob_representation_path GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format)
active_storage/representations#show
rails_disk_service_path GET /rails/active_storage/disk/:encoded_key/*filename(.:format)
active_storage/disk#show
update_rails_disk_service_path PUT /rails/active_storage/disk/:encoded_token(.:format)
active_storage/disk#update
rails_direct_uploads_path POST /rails/active_storage/direct_uploads(.:format)
active_storage/direct_uploads#create
Request
Parameters:
{"name"=>"力士", "tel"=>"0900", "password"=>"[FILTERED]"}
Toggle session dump
Toggle env dump
Response
Headers:
None