Fix issue caused by select IDs containing colons.

This commit is contained in:
Patrick Filler 2011-07-31 12:08:34 -04:00
parent 055f43b026
commit e10951b7a4
4 changed files with 4 additions and 4 deletions

View file

@ -44,7 +44,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.replace('.', '_') : this.generate_field_id();
this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
this.container_id += "_chzn";
this.f_width = this.form_field_jq.width();
this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;

View file

@ -36,7 +36,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().replace('.', '_') + "_chzn";
this.container_id = this.form_field.identify().replace(/(:|\.)/g, '_') + "_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,

View file

@ -44,7 +44,7 @@ class Chosen
@choices = 0
set_up_html: ->
@container_id = if @form_field.id.length then @form_field.id.replace('.', '_') else this.generate_field_id()
@container_id = if @form_field.id.length then @form_field.id.replace(/(:|\.)/g, '_') else this.generate_field_id()
@container_id += "_chzn"
@f_width = @form_field_jq.width()

View file

@ -42,7 +42,7 @@ class Chosen
set_up_html: ->
@container_id = @form_field.identify().replace('.', '_') + "_chzn"
@container_id = @form_field.identify().replace(/(:|\.)/g, '_') + "_chzn"
@f_width = if @form_field.getStyle("width") then parseInt @form_field.getStyle("width"), 10 else @form_field.getWidth()