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.
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 thesubmitcallback for the form):