Index: trunk/extensions/SemanticForms/libs/SemanticForms.js |
— | — | @@ -56,11 +56,21 @@ |
57 | 57 | |
58 | 58 | /* delimiter != '' means multiple autocomplete */ |
59 | 59 | |
60 | | - if (delimiter != null) { |
| 60 | + if (delimiter != null) { |
| 61 | + // Special handling for "\n" - if it's that, change it to an |
| 62 | + // actual newline - otherwise, add a space to the end. |
| 63 | + // This doesn't cover the case of a delimiter that's a newline |
| 64 | + // plus something else, like ".\n" or "\n\n", but in our |
| 65 | + // experience no one has yet needed that. |
| 66 | + if ( delimiter == "\\n" ) { |
| 67 | + delimiter = "\n"; |
| 68 | + } else { |
| 69 | + delimiter += " "; |
| 70 | + } |
61 | 71 | |
62 | 72 | jQuery(document).ready(function(){ |
63 | 73 | function split(val) { |
64 | | - return val.split(delimiter+" "); |
| 74 | + return val.split(delimiter); |
65 | 75 | } |
66 | 76 | function extractLast(term) { |
67 | 77 | return split(term).pop(); |
— | — | @@ -84,7 +94,7 @@ |
85 | 95 | terms.push( ui.item.value ); |
86 | 96 | // add placeholder to get the comma-and-space at the end |
87 | 97 | terms.push(""); |
88 | | - this.value = terms.join(delimiter+" "); |
| 98 | + this.value = terms.join(delimiter); |
89 | 99 | return false; |
90 | 100 | } |
91 | 101 | }); |
— | — | @@ -595,8 +605,7 @@ |
596 | 606 | var field_string = sfgAutocompleteMappings[field_num]; |
597 | 607 | if (field_string) { |
598 | 608 | var div_id = input_id.replace(/input_/g, 'div_'); |
599 | | - var field_values = new Array(); |
600 | | - field_values = field_string.split(','); |
| 609 | + var field_values = field_string.split(','); |
601 | 610 | var delimiter = null; |
602 | 611 | var data_source = field_values[0]; |
603 | 612 | if (field_values[1] == 'list') { |