# HG changeset patch # User Nathan Phillip Brink # Date 2010-10-29 19:45:23 # Node ID 59ee50e4d13c065ff3f7fd90f08c8730c2f7ad68 # Parent 373c6afba3716fea84f5fd4d0883bf0e593cbab9 Automatically add a new class each time an auto.php?getsections AJAX call returns a valid list of sections to reduce user confusion about how to use autocomplete. diff --git a/scripts/scheduleInput.js b/scripts/scheduleInput.js --- a/scripts/scheduleInput.js +++ b/scripts/scheduleInput.js @@ -175,6 +175,11 @@ function add_sections(cnum, data) var i; if (!data.sections) return; + /* + * we get the sections in the correct order. For the user to see + * them in the correct order, we must reverse the add_setion_n() + * calls. + */ for (i = data.sections.length - 1; i >= 0; i --) { section = data.sections[i]; @@ -203,7 +208,11 @@ function add_sections(cnum, data) context: {'class_num': event.data.class_num}, success: function(data, textStatus, reqobj) { - add_sections(this.class_num, data); + if (data.sections) + { + add_sections(this.class_num, data); + add_class(); + } } } );