diff --git a/chosen/chosen.jquery.js b/chosen/chosen.jquery.js index 34b6e12..324c82d 100644 --- a/chosen/chosen.jquery.js +++ b/chosen/chosen.jquery.js @@ -43,7 +43,7 @@ }; Chosen.prototype.set_up_html = function() { var container_div, dd_top, dd_width, sf_width; - this.container_id = this.form_field.id.length ? this.form_field.id : this.generate_field_id(); + this.container_id = this.form_field.id.length ? this.form_field.id.replace('.', '_') : this.generate_field_id(); this.container_id += "_chzn"; this.f_width = this.form_field_jq.width(); this.default_text = this.form_field_jq.attr('title') ? this.form_field_jq.attr('title') : this.default_text_default; @@ -686,7 +686,7 @@ }; Chosen.prototype.generate_random_id = function() { var string; - string = 'sel' + this.generate_random_char() + this.generate_random_char() + this.generate_random_char(); + string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char(); while ($("#" + string).length > 0) { string += this.generate_random_char(); } diff --git a/chosen/chosen.proto.js b/chosen/chosen.proto.js index aa41d76..8058b98 100644 --- a/chosen/chosen.proto.js +++ b/chosen/chosen.proto.js @@ -35,7 +35,7 @@ }; Chosen.prototype.set_up_html = function() { var base_template, container_props, dd_top, dd_width, sf_width; - this.container_id = this.form_field.identify() + "_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, diff --git a/coffee/chosen.jquery.coffee b/coffee/chosen.jquery.coffee index 6098a38..8a2b250 100644 --- a/coffee/chosen.jquery.coffee +++ b/coffee/chosen.jquery.coffee @@ -43,7 +43,7 @@ class Chosen @choices = 0 set_up_html: -> - @container_id = if @form_field.id.length then @form_field.id else this.generate_field_id() + @container_id = if @form_field.id.length then @form_field.id.replace('.', '_') else this.generate_field_id() @container_id += "_chzn" @f_width = @form_field_jq.width() @@ -585,7 +585,7 @@ class Chosen new_id generate_random_id: -> - string = 'sel' + this.generate_random_char() + this.generate_random_char() + this.generate_random_char() + string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char() while $("#" + string).length > 0 string += this.generate_random_char() string diff --git a/coffee/chosen.proto.coffee b/coffee/chosen.proto.coffee index b8ad47f..da7b5b8 100644 --- a/coffee/chosen.proto.coffee +++ b/coffee/chosen.proto.coffee @@ -41,7 +41,7 @@ class Chosen set_up_html: -> - @container_id = @form_field.identify() + "_chzn" + @container_id = @form_field.identify().replace('.', '_') + "_chzn" @f_width = if @form_field.getStyle("width") then parseInt @form_field.getStyle("width"), 10 else @form_field.getWidth()