app/soc/templates/soc/templatetags/_as_table_row.html
changeset 1215 b21e40ef8dad
parent 956 aaac33732ad5
child 1270 a48a592919b0
--- a/app/soc/templates/soc/templatetags/_as_table_row.html	Wed Feb 04 23:04:10 2009 +0000
+++ b/app/soc/templates/soc/templatetags/_as_table_row.html	Wed Feb 04 23:06:48 2009 +0000
@@ -31,6 +31,23 @@
   </td>
   {% endblock %}
   <td>
+  {% if select_url %}
+    <script type="text/javascript">
+      $.getJSON("{{ select_url }}",
+        function(data){
+          $("#{{ field_id }}").autocomplete(data.data, {
+            matchContains: true,
+            formatItem: function(item) {
+              return item.link_id+" ("+item.name+")";
+            },
+            formatResult: function(item) {
+              return item.link_id;
+            }
+          });
+        }
+      );
+    </script>
+  {% endif %}
     {{ field }}
   </td>
 
@@ -40,19 +57,9 @@
   <td></td>
   {% endif %}
 
-  {% if select_url %}
-  <td><input type="button" onclick="location.href='{{ select_url }}'" value="Select"/></td>
-  {% else %}
-  <td></td>
-  {% endif %}
-
   {% if example_text %}
     <td class="formfieldexample">{{ example_text|safe }}</td>
   {% else %}
-    {% if select_url %}
-      <td class="warning">(discards unsaved changes)</td>
-    {% else %}
       <td></td>
-    {% endif %}
   {% endif %}
 </tr>