app/templates/projrev/proposal/submit.html
changeset 38 3cb38edbe05f
parent 24 7257b66a6766
--- a/app/templates/projrev/proposal/submit.html	Mon Aug 10 17:18:07 2009 +0530
+++ b/app/templates/projrev/proposal/submit.html	Mon Aug 10 19:38:53 2009 +0530
@@ -8,8 +8,23 @@
     $('#id_state').chainSelect('#id_district','/proposal/submit/get_dfors');
   });
   $(document).ready(function() {
-	  $.get('/proposal/submit/get_dfors', function() {
-      $('#id_district').html('<option value="">---------</option>');
+	  dt_val = $('#id_district').val();
+	  $.getJSON('/proposal/submit/get_new_dfors',
+		{ '_value': $('#id_state').val() }, 
+		function(data) {
+			var option_html = "";
+			for (i in data) {
+				if (data[i]) {
+				  for (key in data[i]) {
+					  if (key == dt_val) {
+						  option_html += '<option selected="selected" value="'+ key +'">'+ data[i][key] +'</option>';
+					  } else {
+					    option_html += '<option value="'+ key +'">'+ data[i][key] +'</option>';
+					  }
+				  }
+				}
+			}
+      $('#id_district').html(option_html);
 	  });
   });
 </script>