• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 34
  • Last Modified:

jquery autocompolete multiselect

dear all
i jave a jquery autocomplete multiselect how to return the selection values into array
0
pamela rizk
Asked:
pamela rizk
  • 6
  • 2
  • 2
1 Solution
 
pamela rizkDeveloperAuthor Commented:
dear all

i select 1, test
then 2 'test2'
i need to fill into an array these 2 values
please help
0
 
pamela rizkDeveloperAuthor Commented:
any news?
0
 
Julian HansenCommented:
Please post your code.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
leakim971PluritechnicianCommented:
check this page : https://jqueryui.com/autocomplete/#multiple
look at source of the example
check this lines :
        select: function( event, ui ) {
          var terms = split( this.value );
          // remove the current input
          terms.pop();
          // add the selected item
          terms.push( ui.item.value );
          // add placeholder to get the comma-and-space at the end
          terms.push( "" );
          // terms is an array, we create a CSV string to update the value of the input
          this.value = terms.join( ", " ); 
          return false;
        }

Open in new window


You see terms is your array
0
 
pamela rizkDeveloperAuthor Commented:
terms is the array separated by ", " but what if ui.item.value contains a value with , "?
0
 
leakim971PluritechnicianCommented:
Nothing... A string is not an array...
0
 
pamela rizkDeveloperAuthor Commented:
I he the below string

dim k as string="Employee1, Boutros William Ton,Partner, Employee2, "

i am splitting this string as below :
  Dim NameValue As String =k
        Dim Nameelements() As String = NameValue.Split(New Char() {",  "}, StringSplitOptions.RemoveEmptyEntries)

but the output is not correct

i need the output to be an array with 3 columns :
Employee1
Boutros William Ton,Partner
Employee2

how to do that
0
 
Julian HansenCommented:
What output are you getting?

Note in this line you have a trailing comma
dim k as string="Employee1, Boutros William Ton,Partner, Employee2, "

Open in new window

This will result in an array of 4 items.
0
 
pamela rizkDeveloperAuthor Commented:
i solved my problem using
Regex.Split(_k, ", ")
0
 
pamela rizkDeveloperAuthor Commented:
ok
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now