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

  • Home
  • SEARCH
  • 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 7817109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:07:16+00:00 2026-06-02T06:07:16+00:00

The task I’m trying to accomplish: I have a Rails 3 application that processes

  • 0

The task I’m trying to accomplish:

I have a Rails 3 application that processes work orders for a telecommunications company. The index page of the work orders controller displays paginated work orders in rows of up to 30 per page.

There are two fields that the client would like to be able to update from this page. They are Technician ETA and Work Order Status. I’ve written some code to use jquery dialog popups to serve partial forms (one for each field) for update.

So far I’ve been able to get the popups to serve the form partials but they only work for the first row. The links for subsequent rows on the page don’t work. I expect that this is because the divs containing the calls to the partials have to be uniquely named for each row (each work order in this case.)

At the moment I’m only trying to address the issue of getting the iterations of dialog popups for each row to work on the front end. This is what I have for code currently:

the .js:

$(document).ready(function() {
$('div#status-chg-form').dialog({ autoOpen: false });
$('#statuslink').click(function(){ $('div#status-chg-form').dialog('open'); });
});

$(document).ready(function() {
$('div#eta-chg-form').dialog({ autoOpen: false });
$('#etalink').click(function(){ $('div#eta-chg-form').dialog('open'); });
});

the divs to render the partials (in my index view):

<div id="status-chg-form" title="CHANGE WORK ORDER STATUS" style="display:none"><%= render :partial => 'statusform' %></div>
<div id="eta-chg-form" title="CHANGE TECHNICIAN ETA" style="display:none"><%= render :partial => 'etaform' %></div>

and the links (in my index view):

<a href="#" id="statuslink"><%= status_display %></a>

(note: status_display variable is populated correctly)

<% if work_order.soft_completion_datetime.blank? %>
    <a href="#" id="etalink"><%= "No ETA Entered" %></a>
<% else %>
    <a href="#" id="etalink"><%= work_order.soft_completion_datetime.strftime('%m/%d/%Y %I:%M %p') %></a>
<% end %>

I’m thinking I can use the id from the work order row as a unique identifier for each occurrence of the dialog pop up, but I’m not a seasoned jquery coder so I am in need of a greater mind to point me in the right direction.

  • 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-06-02T06:07:18+00:00Added an answer on June 2, 2026 at 6:07 am

    Ok, so I have a partial solution to this problem but I’m still having some difficulty with the jquery.

    To uniquely identify the dialog div’s and the corresponding links I did this:

    For Status:

                <% statusidname = "statuslink-" + work_order.id.to_s %>
                <%= link_to (status_display, "#", :id => statusidname, :onclick => "statusdialog('#{work_order.id.to_s}')") %>    
                <% statusdivname = "status-chg-form-" + work_order.id.to_s %>
                <%= content_tag :div, :class => statusdivname, :style =>"display:none" do %>
                   <%= render :partial => 'statusform' %>
                <% end %>
    

    and for ETA:

           <% etaidname = "etalink-" + work_order.id.to_s %>    
           <% if work_order.soft_completion_datetime.blank? %>
             <%= link_to ("No ETA Entered", "#", :id => etaidname, :onclick => "etadialog('#{work_order.id.to_s}')") %>
           <% else %>
             <%= link_to (work_order.soft_completion_datetime.strftime('%m/%d/%Y %I:%M %p'), "#", :id => etaidname, :onclick => "etadialog('#{work_order.id.to_s}')") %>
           <% end %>
           <% etadivname = "eta-chg-form-" + work_order.id.to_s %>
           <%= content_tag :div, :class => etadivname, :style =>"display:none" do %>
              <%= render :partial => 'etaform' %>
           <% end %>
    

    In summary essentially this code creates links that are named statuslink-999 and etalink-999 and divs named status-chg-form-999 and eta-chg-form-999 where 999 is the work_order.id thereby uniquely naming each link and div for each row.

    This is my .js. It is currently not working. I can’t figure out what exactly I’m doing wrong here but the script is not receiving the rowid.

    $(function statusdialog(rowid) {
    $('div#status-chg-form-'+rowid).dialog({ autoOpen: false });
    $('#statuslink-'+rowid).click(function(){ $('div#status-chg-form-'+rowid).dialog('open'); });
    });
    
    $(function etadialog(rowid) {
    $('div#eta-chg-form-'+rowid).dialog({ autoOpen: false });
    $('#etalink-'+rowid).click(function(){ $('div#eta-chg-form-'+rowid).dialog('open'); });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The task I was trying to accomplish was that given an input pattern, e.g.
Task: have a jailbroken iPhone need to write an application which would receive notifications
Task: implement paging of database records suitable for different RDBMS. Method should work for
Task at hand — I have three versions of some code, developed by different
TASK : I have an existing xml document (UTF-8) which uses xml namespaces and
Task: I have a camera mounted on the end of our assembly line, which
Task: Cut or erase a file after first walk-through. i have an install file
Task: Write timestamps into MS SQL database table every second. Solutions: External application which
Task is: I have task queue stored in db. It grows. I need to
the task is quite simple, but i have not figured it out yet. one

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.