Solved

jquery autocompolete multiselect

Posted on 2016-08-14
10
27 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 55

Expert Comment

by:Julian Hansen
ID: 41756020
Please post your code.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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 55

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
call a controller action method from Global.asax in asp.net 1 20
SSRS Deployment problem 5 65
html border input line 7 13
Adding items to a C# list incrementally 5 30
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

856 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