Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7872709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:17:22+00:00 2026-06-03T02:17:22+00:00

I have a form: %form{:action:method => post} %fieldset %label{:for => title} Title: %input{:name =>

  • 0

I have a form:

  %form{:action:method => "post"}
    %fieldset
      %label{:for => "title"} Title:
      %input{:name => "title", :type => "text", :value => ""}/
      %label{:for => "notes"} Notes:
      %input{:name => "notes", :type => "text", :value => ""}/
    %a.finish{:href => "/rotas", :method => "post"} Finish!

However, the link does not seem to want to work – maybe I am missing something basic in Haml, or in Rails.

I have a :resource rotas in my routes.rb and my controller has a def create method.

Any help is appreciated! Thanks!

btw. I generated using scaffold – and it seems that the same form is used for edit a model and for a creation. How does it know whether to do a POST or a PUT?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:17:24+00:00Added an answer on June 3, 2026 at 2:17 am

    1) You want to put the target of the form in the action:

    %form{ :action => "/rotas", :method => "post" }
    

    2) You want a submit button, not a link. Try this:

    %input{ :type => "submit" } Finish!
    

    Also, I’m not sure why you’re putting a / after your inputs, that’s not needed for anything. I don’t think it hurts, but I see no reason to include it.

    3) Lastly, the Rails convention is not to use haml elements but rather form helpers, which would look like this:

    = form_tag '/rotas' do
      = field_set_tag do
        = label_tag :title, 'Title:'
        = text_field_tag :title
        = label_tag :notes, 'Notes:'
        = text_field_tag :notes
        = submit_tag 'Save Changes'
    

    One reason for this is Rails is going to include a hidden Authenticity Token field in the form for you, and normally Rails controllers won’t accept forms that are submitted without this authenticity token value. This is to prevent Cross-Site Request Forgery.

    Try this and see what you get.

    See the FormTagHelper API for reference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple form like this: <form name=serachForm method=post action=/home/search> <input type=text name=searchText
<form id=login_frm method=post action = /login/user_auth/> <fieldset> <legend>Login:</legend> <label for=id_email>Email</label> <input type=text name=email id=id_email
I have an HTML form: <form action='process.php' method='post'> <input type='checkbox' name='check_box_1' /> Check me!<br>
I have the following form: <form action=post.php method=POST> <fieldset> <div class=ratingClass> <input type=radio class=radio
I have form like this: <form method=POST action=<?php echo base_url() ?>admin/admin_search> <fieldset> <label for=nalozi>Nalozi</label><input
I have this HTML: <form action='uploadhandle.php' method='POST' enctype=multipart/form-data> <input type='file' class='fileinput' id='photo1' name='photo1'> <input
I have this form: $form = array( '<form name=backup-form class=backup-form method=post action=#>', '<fieldset class=backup-fields>',
I have a form with the following HTML below: <form id=course_edit_form name=course_form action=/courses/save method=post>
I'm using this HTML code: <form action=# method=post> <fieldset> <label class=desc id=title10 for=Field10> How
I have the following HTML form: <div id=main> <form Id=search-form action=/ViewRecord/AllRecord method=post> <div> <fieldset>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.