Solved

jquery autocompolete multiselect

Posted on 2016-08-14
10
24 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 51

Expert Comment

by:Julian Hansen
ID: 41756020
Please post your code.
0
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 51

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
JavaScript error 1 34
JavaScript Scope issue 4 20
Make all values in arrayist to titlecase+vb.net 23 12
React or Angular? 5 0
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now