Solved

jquery autocompolete multiselect

Posted on 2016-08-14
10
29 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 57

Expert Comment

by:Julian Hansen
ID: 41756020
Please post your code.
0
More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

 
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 57

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…

691 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