Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Field name for tags can now be set via the "field_name" option

  • Loading branch information...
commit 9b881068db520cb02988841ca7795f81efdd0b21 1 parent b3956ad
Rick Fletcher authored
Showing with 7 additions and 8 deletions.
  1. +1 −1  src/lib/Tagbox.Tag.js
  2. +6 −7 src/lib/Tagbox.js
2  src/lib/Tagbox.Tag.js
View
@@ -36,7 +36,7 @@ Tagbox.Tag = Class.create( {
initialize: function( tagbox, properties ) {
this.tagbox = tagbox;
this.properties = new Hash( this.properties );
- this.properties.set( 'field_name', tagbox.name );
+ this.properties.set( 'field_name', tagbox.options.get( 'field_name' ) );
if( typeof properties == "string" ) {
properties = { value: properties };
13 src/lib/Tagbox.js
View
@@ -36,6 +36,8 @@ var Tagbox = Class.create( {
* and/or permitted tags.
* delimiters (Array) = [ Event.KEY_COMMA, Event.KEY_RETURN ]:
* Array of keyCodes which trigger addition to the list of tags.
+ * field_name (String) = name of the original text input
+ * The form field name, taken from the original input element.
* hint (String) = null:
* A brief instruction to the user.
* hint_delay (Number) = 100:
@@ -64,6 +66,7 @@ var Tagbox = Class.create( {
delimiters: [ Event.KEY_COMMA, Event.KEY_RETURN ],
hint: null,
hint_delay: 100,
+ field_name: null,
max_tags: null,
result_converter: null,
show_remove_links: true,
@@ -89,12 +92,6 @@ var Tagbox = Class.create( {
hint_timeout: null,
/**
- * Tagbox#name -> String
- * The form field name, taken from the original input element.
- **/
- name: null,
-
- /**
* Tagbox#element -> Element
* The tagbox (<div/>) element.
**/
@@ -116,7 +113,9 @@ var Tagbox = Class.create( {
this.options = new Hash( this.options ).update( options );
this.tags = [];
- this.name = $( original_input ).getAttribute( 'name' );
+ if( ! this.options.get( 'field_name' ) ) {
+ this.options.set( 'field_name', $( original_input ).getAttribute( 'name' ) );
+ }
this.initializeAllowedTags();
this.insert( original_input );
Please sign in to comment.
Something went wrong with that request. Please try again.