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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:06:53+00:00 2026-05-12T18:06:53+00:00

I have a form_remote working perfectly for the form currency. The only change I

  • 0

I have a form_remote working perfectly for the form currency. The only change I want to make is the do away with submit button for a select box. So they just click the correct currency and it submits the ajax request.

<%= collection_select(:currency, :set, Currency.find(:all, :conditions => 'primary_source = "ECB"'), :code, :pretty_name, { :selected => session[:currency] }, { :onchange => "$('currency').submit()" } )  %>

The onchange works for the select, but instead of using the remote ajax request, it refeshes the entire page… instead of just one element, how can I initiate the remote_tag so that it does the same thing clicking submit would?

  • 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-12T18:06:54+00:00Added an answer on May 12, 2026 at 6:06 pm

    The problem you’re having is that Rails implements remote_form_for as an inline Ajax method in the onsubmit attribute of the form. The problem is that the submit event only fires when a user physically submits the form, not by calling $(‘form’).submit(). Actually I believe some browsers may fire the event but others don’t. In any case, this won’t work in the general case as you discovered.

    One possible workaround, and I have only tested this in Firefox 3.5, so your mileage may vary, is to call the attribute as a function directly. So inside your :onchange put:

    $('currency').onsubmit()
    

    If that doesn’t work you may need to look at the generated source, and pull the AJAX request out of the onsubmit attribute and into a standalone method that you can call directly.

    As far as I know there is no cross-browser way to reliably fire a native event.

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

Sidebar

Related Questions

I have my Ajax working, builtin Rails javascript, with the submit button. However, I
i have a form with 2 fields username: password: and a submit button. the
I have a Rails app and trying to make a remote form, so far
I have form with 1 button. when you click on the button 3 others
I have a form field that I would like to empty immediately the submit.
I have a form with select fields dynamically generated and with the options taken
I have the following form in a rails app which is not working: <%
I have a rails 3 remote form tag that I am trying to submit
I have been working on creating a PHP email form recently and cannot manage
So i have a form generated by formtastic and it's working : <%semantic_form_for(Model.new,:url=>{:action=>fooobar}) do

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.