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

  • Home
  • SEARCH
  • 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 910417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:02:26+00:00 2026-05-15T17:02:26+00:00

I want to render a form (fields and includes a submit button) when using

  • 0

I want to render a form (fields and includes a submit button) when using link_to_remote — the form appears via an ajax call.

I’d like that form to behave as any other form would (it’s a basic New Active Record) form, nothing fancy.

Upon submit, though, I’d like the original parent page to remain static without refreshing and, instead of the form, the notice (your form has been successfully submitted) in its place.

Current behavior, upon submit, it redirects the entire page.

I put the remote into a method:

<%= do_event_remote(contact_event, event) %>

And here is this helper method:

  def do_event_remote(contact, call_or_email_or_letter) 
    model_name = call_or_email_or_letter.class.name.tableize.singularize 
    link_to_remote "#{model_name.camelize}", 
                   :url => send("new_contact_#{model_name}_path", 
                                            :contact => contact, 
                                            :status => 'done',
                                            :"#{model_name}" => call_or_email_or_letter ),
                   :update => 'remote_event'                                     
  end 

Thanks…

  • 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-05-15T17:02:27+00:00Added an answer on May 15, 2026 at 5:02 pm

    You create the form as normal but you use the remote_form_for helper in the place of the form_for and the remote_form_tag in the place of form_tag. This will submit the form via ajax.

    Documenation at: http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html

    Update: Example:

    In your form (using haml):

    = remote_form_for @customer, :url => customer_path(@customer), :complete => "doSomething(request)" do |f|
      %p
        First Name<br>
        = f.text_field :first_name
      %p
        Last Name<br>
        = f.text_field :last_name
      = submit_tag "Update"
    

    For your fade functions, you would need to use scriptaculous or jquery. Scriptaculous comes packaged with rails and is currently the default. For that, your javascript would be something like this:

    function doSomething(request){
      Effect.fade('some_div');
    }
    

    more on scriptaculous: http://wiki.github.com/madrobby/scriptaculous/

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

Sidebar

Related Questions

I want to render the partial view using ajax. When I submit the button,
I have my store form that's created by ajax and want to reset certain
I want to render a profile user container that contains a list of labels
Well I want to render a self closing tag say <img> tag like this
I have a form to which I want to add extra fields depending on
I have an express app that I want to use the connect-form module on
I'm using remote_form_for in Ruby on Rails to create a form that, once submitted,
I want to add extra infos for some fields of a django form, and
Is it possible to set the location you want to submit a form to
What I want to do is: I want to render a form on a

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.