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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:08:52+00:00 2026-05-30T18:08:52+00:00

Each time someone changes their response in a radio button it is recorded in

  • 0

Each time someone changes their response in a radio button it is recorded in the database. Here’s the javascript in the application.js file:

$('.submittable').live('change', function() {
    $(this).parents('form:first').submit();
    return false;
});

In the radio button HTML is:

class="submittable"

In the full site there is no change in the page because it is suppressed in the controller like so:

def update_result
   ...
   render :nothing => true
end

However, in the mobile version the page flips to a page that says undefined in the top left corner but otherwise is blank. The terminal window message:

...
Processing by AnswersController#update_result as JS
...
Rendered text template (0.0ms)
Completed 200 OK in 309ms (Views: 5.6ms | ActiveRecord: 5.1ms)

Thanks for your help.

  • 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-30T18:08:53+00:00Added an answer on May 30, 2026 at 6:08 pm

    When using jQuery Mobile, to submit a form by ourselves (so no page-change occurs), we have to set data-ajax="false" on the <form> tag and then setup our own AJAX function (in the submit callback for the form):

    //as of jQuery 1.7 `.live()` is depreciated in favor of `.delegate()`
    $(document).delegate('.submittable', 'change', function() {
    
        //`.closest('form')` is the same as `.parent('form:first')`, also `.submit()` is shorthand for `.trigger('submit')`, just FYI
        $(this).closest('form').trigger('submit');
        return false;
    }).delegate('form', 'submit', function () {
    
        //cache the jQuery object of this form and use that variable to setup the AJAX request
        var $form = $(this);
        $.ajax({
            url     : $form.attr('action'),//use the form's action attribute for the URL of the request
            type    : $form.attr('method'),//use the form's method attribute to set the TYPE of the request
            data    : $form.serialize(),//add the form input data to the request
            success : function (serverResponse) {
                //the server has responded, whatever was output by the server-side script is available through the `serverResponse` variable
            },
            error   : function (jqXHR, textStatus, errorThrown) {
                //make sure to handle errors
            }
        });
    
        return false;
    });
    
    <form action="..." data-ajax="false" method="post">
        ...
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I set up a hitcounter so that each time someone goes to my site,
Each time a python file is imported that contains a large quantity of static
How do I run a batch file each time windows boots up also I
Do the initializers in a Rails app run each time someone visits the site?
Each time my webpage is loaded it runs a routine in the page_load event
Each time I click on the map a new marker is placed on the
I want to output the function name each time it is called, I can
It's a WiX MSI installer and each time I uninstall and reinstall it in
I'm getting this message each time I compile my project: RunIPhoneUnitTest.sh: line 92: 31389
I am relatively new to C# and each time I begin to work on

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.