mdbootstrap / bootstrap-templates

A collection of free Bootstrap 5 templates.
https://mdbootstrap.com/freebies/
3.07k stars 1.02k forks source link

Tags with comma #610

Closed danndaghost closed 2 years ago

danndaghost commented 7 years ago

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!

Grunfi commented 6 years ago

Thanks!

filiperhiza commented 6 years ago

Very nice, helped me a lot. Thank you

thiagojoa commented 5 years ago

Thanks for the help!

leon0707 commented 5 years ago

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

ElsnerPHP commented 4 years ago

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

Souvikray commented 4 years ago

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