-1

在我的 JavaScript 中,我有三个Links. second link是否打开取决于first link id所选内容。一切正常。但是在选择之后second link,如果我想更改first linksecond link仍然会为旧版本打开id。如果我想更改first link,所有的fields都应该更改并按照first link.

 var generic_lookup_Enr_Rds_Section2009_selected = function(id, to_s) {
      var question_link = $('#question_picker').attr('href');
      question_link = question_link.replace(/\?+$/, '');
      question_link = question_link + '?columns[enr_rds_section_id]=' + id;
      $('#question_picker').attr('href', question_link);
      $("#modal_popup").dialog("destroy");

  };

  var generic_lookup_Enr_Rds_Question2009_selected = function(id, to_s) {
      var answer_link = $('#answer_picker').attr('href');
      answer_link = answer_link.replace(/\?+$/, '');
      answer_link = answer_link + '?columns[enr_rds_question_id]=' + id;
      $('#answer_picker').attr('href', answer_link);
      $("#modal_popup").dialog("destroy");
  };

html

<div class="question">
      <%= f.label :Section %>
      <%= link_to pro_generic_lookup_data_path("Enr::Rds::Section2009", format: :js), data: {remote: true} do %>
        <%= image_tag("Search-icon.gif", border: 0, :alt => "Look up Sections", title: 'Lookup Sections') %>
      <% end %>
 </div>

  <div class="question">
      <%= f.label :Question %>
      <%= link_to pro_generic_lookup_data_path("Enr::Rds::Question2009", format: :js), data: {remote: true}, id: "question_picker" do %>
        <%= image_tag("Search-icon.gif", border: 0, :alt => "Look up Questions", title: 'Lookup Questions', :class => "image_section_search") %>
      <% end %>
 </div>
4

1 回答 1

0

Solved it by Javascript using cascading dropdown function by example. Thanks guys.

于 2012-10-18T14:49:44.473 回答