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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:32:27+00:00 2026-05-31T09:32:27+00:00

In my Rails 3.1 application I have a Jquery dialog that pops up when

  • 0

In my Rails 3.1 application I have a Jquery dialog that pops up when clicked, and inside that you have a submit button. I have made somewhat an attempt at making this ‘submit’ button ajax. So that when it is clicked it updates the appointment time and date. I have the following code:

<% if @booking.id and current_user.is_booking_manager? %>
<button id="confirm_appointment">
    test confirmation
</button>
<div style="display:none;">
    <div id="confirm_appointment_dialog" title="Test Confirm Booking">
        <%= form_for @booking, :url => booking_confirmation_path(@booking), :remote => true do |f| %>
        <%= f.hidden_field :id %>
        <%= f.datetime_select :confirmed_appointment %>
        <br />
        <b>Clear provisional appointment:</b><%= check_box_tag "make_unexpected" %>
        <br />
        <%= f.submit :class => 'submit_me' %>
        <% end %>
    </div>
</div>
<% end %> 

Application.js

$('.submit_me').bind('change', 
function() {
    $(this).parents('form:first').submit();
}); 

Is there something I am missing

  • 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-31T09:32:28+00:00Added an answer on May 31, 2026 at 9:32 am

    You don’t update your View, after the JS request is processed. First you need to add an id to the HTML-Element you want to update.

    Your Pastie had this Code:

    <tr>
      <td><%= f.label :confirmed_appointment %></td>
      <td> <% f.hidden_field :confirmed_appointment %>
      <% if @booking.confirmed_appointment %>
      <%= l @booking.confirmed_appointment %>
      <% else %> <em>unconfirmed</em> <% end %> </td>
    </tr>
    

    In order to make it easy to reference the part you want to update in JavaScript, let’s add an id to that td.

      <td id="booking-confirmation"> <% f.hidden_field :confirmed_appointment %>
    

    After that you need to create an update.js.erb in your views/ folder. Now you can put the line

      $("#booking-confirmation").html("<%= l @booking.confirmed_appointment %>");
    

    In there, which will look for a field with the id “booking-confirmation” in your HTML and update it.

    Lastly, be sure to include

     respond_to do |format|
       format.html
       format.js
     end
    

    In your action, to make the action respond to JS calls.

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

Sidebar

Related Questions

I have a Rails application that in the erb code, I use a select
We have a rails application in subversion that we deploy with Capistrano but have
I am working on a rails application that uses big javascript libraries (e.g. jquery
I have a rails application and I have all the jQuery scattered out in
I have an rails a application whereby it has a page that contains a
I have a Rails application and I'm using jQuery to query my search view
I am currently working on rails3 application that uses jQuery. I have a javascript
Wanting to play with jQuery, Orbited, and FasterCSV, I made a Rails chat application.
I have a Rails 3.1 application that uses devise for authentication. I am trying
I have a ruby on rails application with an input text field that has

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.