Solved

jquery autocompolete multiselect

Posted on 2016-08-14
10
26 Views
Last Modified: 2016-09-06
dear all
i jave a jquery autocomplete multiselect how to return the selection values into array
0
Comment
Question by:pamela rizk
  • 6
  • 2
  • 2
10 Comments
 

Author Comment

by:pamela rizk
ID: 41755250
dear all

i select 1, test
then 2 'test2'
i need to fill into an array these 2 values
please help
0
 

Author Comment

by:pamela rizk
ID: 41755380
any news?
0
 
LVL 54

Expert Comment

by:Julian Hansen
ID: 41756020
Please post your code.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 82

Expert Comment

by:leakim971
ID: 41756053
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
 

Author Comment

by:pamela rizk
ID: 41766360
terms is the array separated by ", " but what if ui.item.value contains a value with , "?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 41767793
Nothing... A string is not an array...
0
 

Author Comment

by:pamela rizk
ID: 41781160
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
 
LVL 54

Expert Comment

by:Julian Hansen
ID: 41781204
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
 

Accepted Solution

by:
pamela rizk earned 0 total points
ID: 41781207
i solved my problem using
Regex.Split(_k, ", ")
0
 

Author Closing Comment

by:pamela rizk
ID: 41785784
ok
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question