diff --git a/chosen/chosen.proto.js b/chosen/chosen.proto.js index 5ab897d..8058b98 100644 --- a/chosen/chosen.proto.js +++ b/chosen/chosen.proto.js @@ -28,14 +28,14 @@ this.result_highlighted = null; this.result_single_selected = null; this.choices = 0; - this.single_temp = new Template('#{default}
'); + this.single_temp = new Template('#{default}
'); this.multi_temp = new Template('
'); - this.choice_temp = new Template('
  • #{choice}
  • '); + this.choice_temp = new Template('
  • #{choice}
  • '); return this.no_results_temp = new Template('
  • No results match "#{terms}"
  • '); }; Chosen.prototype.set_up_html = function() { var base_template, container_props, dd_top, dd_width, sf_width; - this.container_id = this.form_field.id + "_chzn"; + this.container_id = this.form_field.identify().replace('.', '_') + "_chzn"; this.f_width = this.form_field.getStyle("width") ? parseInt(this.form_field.getStyle("width"), 10) : this.form_field.getWidth(); container_props = { 'id': this.container_id, @@ -188,7 +188,7 @@ return this.search_field.focus(); }; Chosen.prototype.test_active_click = function(evt) { - if (evt.target.up('#' + this.container.id)) { + if (evt.target.up('#' + this.container_id)) { return this.active_field = true; } else { return this.close_field(); @@ -227,7 +227,7 @@ }; Chosen.prototype.result_add_group = function(group) { if (!group.disabled) { - group.dom_id = this.form_field.id + "chzn_g_" + group.array_index; + group.dom_id = this.container_id + "_g_" + group.array_index; return '
  • ' + group.label.escapeHTML() + '
  • '; } else { return ""; @@ -236,7 +236,7 @@ Chosen.prototype.result_add_option = function(option) { var classes; if (!option.disabled) { - option.dom_id = this.form_field.id + "chzn_o_" + option.array_index; + option.dom_id = this.container_id + "_o_" + option.array_index; classes = option.selected && this.is_multiple ? [] : ["active-result"]; if (option.selected) { classes.push("result-selected"); @@ -361,7 +361,7 @@ }; Chosen.prototype.choice_build = function(item) { var choice_id, link; - choice_id = this.form_field.id + "_chzn_c_" + item.array_index; + choice_id = this.container_id + "_c_" + item.array_index; this.choices += 1; this.search_container.insert({ before: this.choice_temp.evaluate({ @@ -428,7 +428,7 @@ result_data = this.results_data[pos]; result_data.selected = false; this.form_field.options[result_data.options_index].selected = false; - result = $(this.form_field.id + "chzn_o_" + pos); + result = $(this.container_id + "_o_" + pos); result.removeClassName("result-selected").addClassName("active-result").show(); this.result_clear_highlight(); this.winnow_results(); @@ -762,4 +762,4 @@ return parser.parsed; }; root.SelectParser = SelectParser; -}).call(this); \ No newline at end of file +}).call(this); diff --git a/index.html b/index.html index 0244571..090ab11 100644 --- a/index.html +++ b/index.html @@ -293,7 +293,7 @@
    Into This - @@ -794,7 +794,7 @@
    Into This - @@ -1047,7 +1047,7 @@
    Single Select with Groups - @@ -1101,7 +1101,7 @@
    Multiple Select with Groups - @@ -1160,7 +1160,7 @@

    Chosen automatically highlights selected options and removes disabled options.

    Single Select - @@ -1174,7 +1174,7 @@
    Multiple Select with Groups -