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 8995829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:40:17+00:00 2026-06-15T23:40:17+00:00

In my _form.html.erb file, I have; <%= form_for(@document) do |f| %> <% end %>

  • 0

In my _form.html.erb file, I have;

<%= form_for(@document) do |f| %> 
<% end %>

When I add

<%= form_for(@document), :remote => true do |f| %> 
<% end %>

I get an error. I want to add ajax to this form so the user can submit it, it’ll appear with a notice saving "saved" and then the user can carry on writing in the textarea within the form.

The error says:

SyntaxError in Documents#edit

Showing /app/views/documents/_form.html.erb where line #1 raised:

<%= form_for(@document), :remote => true do |f| %>

It’s saying that line 1 (above) is a syntax error.

How can I add remote true to the form_for so I can add Ajax?

Update

So out of the two answers, I have;

<%= form_for(@document, :remote => true) do |f| %>

and

<%= form_for @document, :remote => true do |f| %>

They both work but is one better than the other or do they end up doing the same thing?

  • 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-15T23:40:18+00:00Added an answer on June 15, 2026 at 11:40 pm

    You’ve inserted the :remote = true right AFTER the parameter list. Just leave off the parenthesis.

    <%= form_for @document, :remote => true do |f| %> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In an edit.html.erb file I have the code <%= form_for @submission do |f| %>
I have inside a fancybox box this form: <%= simple_form_for(@message, :remote => true, :html
I have a html.erb file in one of my views. The file is pretty
In my Ruby on Rails code, I have the following edit.html.erb file for tasks:
I want to create a new user from my form in my new.html.erb file:
I have an .erb file with form template that uses form_for helper to generate
I get this error: NoMethodError in Videos#new Showing /rubyprograms/dreamstill/app/views/videos/new.html.erb where line #1 raised: undefined
I have the following form in my edit.html.erb page <%= form_for(@device) do |f| %>
I am creating a select box for a form using this in _form.html.erb <%=
i have html form i am using <a href="#" onclick="document.aa.submit()"> instead of submit button

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.