简体   繁体   中英

How and where to submit the form values on rails?

I have controller Pages which have methods like home , aboutus , joinus ,contactus and mad.

joinus also has a form given below.

JOIN US

Name

Email

Address

Number

SUBMIT

when I click on submit, Routing error is coming

No route matches [POST] "/pages/joinus"

Rails.root: C:/NEW/charityapp

Application Trace | Framework Trace | Full Trace Routes

Routes match in priority from top to bottom

Helper HTTP Verb Path Controller#Action Path / Url
pages_home_path GET /pages/home(.:format) pages#home root_path GET / pages#home pages_aboutus_path GET /pages/aboutus(.:format) pages#aboutus pages_joinus_path GET /pages/joinus(.:format) pages#joinus pages_contactus_path GET /pages/contactus(.:format) pages#contactus pages_mad_path GET /pages/mad(.:format) pages#mad

If you check what routes you have, you will see

GET /pages/joinus(.:format) pages#joinus pages_contactus_path

Forms trigger POST verb not GET , you need to change this to

POST /pages/joinus(.:format) pages#joinus pages_contactus_path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM