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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:02:03+00:00 2026-05-11T08:02:03+00:00

What is the easiest and most graceful way to auto-submit an AJAX form when

  • 0

What is the easiest and most graceful way to auto-submit an AJAX form when a drop-down box’s option is selected? I’m creating an administration page where the admin can modify user permissions (where ‘permissions’ is stored as an integer), and I would like the ‘permissions’ field to be a drop-down box that automatically submits and updates when the administrator clicks on the option he wants the user to have.

Here’s the stripped-down version of what I’m currently looking at. I need to know the best way to convert this to a remote form that automatically submits when an option is clicked on.

Feel free to point out any tangential suggestions or anything else…I’m relatively new to Rails, and only just reaching the point where I can write code without constantly referencing others’ work.

<!-- This is the 'index' view, by the way. --> <% for membership in @story.memberships %>   <% form_for membership do |f| %>     <%= f.select :permissions, [['none', 0], ['admin', 9]] %>   <% end %> <% end %> 
  • 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. 2026-05-11T08:02:03+00:00Added an answer on May 11, 2026 at 8:02 am

    There are a couple ways to handle this. Certainly the observe field approach is one, but you could also use a simple javascript or a remote_function to do it:

    Here is the simple JS approach:

    <% remote_form_for membership do |f| %>     <%= f.select :permissions, [['none', 0], ['admin', 9]], {}, :onchange => 'this.form.submit()' %> <% end %> 

    The other way would be something like this, and would eschew the form builder (and this may have a couple syntax errors):

    <%= select_tag(:permissions, [['none', 0], ['admin', 9]], {:onchange => '#{remote_function(:url  => permissions_path(:story_id => story,              :with => ''permission='+value')}'}) 

    Personally I prefer the former.

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

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer A couple of tips: Use source control, NOT FTP/etc., for… May 11, 2026 at 1:57 pm
  • added an answer My problem was with HTTP Module. I was applying White… May 11, 2026 at 1:57 pm
  • added an answer You shouldn't need to install it through the package manager.… May 11, 2026 at 1:57 pm

Related Questions

What is the simplest (and easiest, although that's subjective) algorithm for drawing solid (as
What is the easiest way to check if a computer is alive and responding
Given a latitude and longitude, what is the easiest way to find the name
What is the easiest way to compare strings in Python, ignoring case? Of course
What is the easiest way to merge XML from two distinct DOM Documents? Is
What is the most preferred and easiest way to do pagination in ASP.NET MVC?
I'm building a simple udp lan chat application in vb.net and I'm wondering how
Some ways to iterate through the characters of a string in Java are: Using

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.