mdbootstrap/bootstrap-templates

Tags with comma

danndaghost opened this issue · 6 comments

Hello, i wanna use the comma in tags. Change delimiter to ' | ' and when do submit still recive comma separator for input value.
Add this lines to pushVal

var delimiter = (self.options.delimiterRegex) ? self.options.delimiterRegex : self.options.delimiter;
self.$element.val(val.join(delimiter)).trigger('change');

and works!

Thanks!

Very nice, helped me a lot. Thank you

Thanks for the help!

Looks like no one maintains this repo anymore. This should be added into the source.

Looks like no one maintains this repo anymore. This should be added into the source.

Thanks! This worked for me. For those who want to know what exactly to do, I have posted the code below

pushVal: function() {
      var self = this,
          val = $.map(self.items(), function(item) {
            return self.options.itemValue(item).toString();
          });

     // commented this
      /*
      self.$element.val(val, true);
      if (self.options.triggerChange)
        self.$element.trigger('change');
      */

     // added this
     var delimiter = (self.options.delimiterRegex) ? self.options.delimiterRegex : self.options.delimiter;
     if (self.options.triggerChange)
        self.$element.val(val.join(delimiter)).trigger('change');

    },

The version of bootstrap tagsinput that I am running is 0.8.0