Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Remove the need for fieldName #108

Closed
wants to merge 1 commit into from

1 participant

Alex Latchford
Alex Latchford

Currently we're using a set REST API and we want a flat tag list..

tags = ['Cat', 'Dog', etc.];

However with this plugin you can only do...

tags = {
    fieldName : ['Cat', 'Dog', etc.]
};
Alex Latchford Can now have tags without having to specify the nested object propert…
…y, not really understanding why it's always necessary unless nested tags is the main use case?
4050827
Alex Latchford

Should really test this out before I opened this up :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 15, 2012
  1. Can now have tags without having to specify the nested object propert…

    Alex Latchford authored
    …y, not really understanding why it's always necessary unless nested tags is the main use case?
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +4 −3 js/tag-it.js
7 js/tag-it.js
View
@@ -29,7 +29,7 @@
$.widget('ui.tagit', {
options: {
itemName : 'item',
- fieldName : 'tags',
+ fieldName : null,
availableTags : [],
tagSource : null,
removeConfirmation: false,
@@ -339,8 +339,9 @@
tags.push(value);
this._updateSingleTagsField(tags);
} else {
- var escapedValue = label.html();
- tag.append('<input type="hidden" style="display:none;" value="' + escapedValue + '" name="' + this.options.itemName + '[' + this.options.fieldName + '][]" />');
+ var escapedValue = label.html(),
+ field = (this.options.fieldName) ? '[' + this.options.fieldName + ']' : '';
+ tag.append('<input type="hidden" style="display:none;" value="' + escapedValue + '" name="' + this.options.itemName + field + '[]" />');
}
this._trigger('onTagAdded', null, tag);
Something went wrong with that request. Please try again.