[jQuery] cant pass value to ajax call.
here is my code. $("#ddl_customer").change(function(){ cuslist = $("#ddl_customer").val().join(", "); alert(cuslist); }); $("#ddl_customer").selectChain({ target: market, url: callback_url, type: "POST", data: { ajax: true, multsel: market_selects, cust_val: cuslist } }).trigger('change'); This is an except from remy sharp's plugin for chaining multiple select boxes. I want to pass "cuslist" which is a list of numbers to the select chain function. which is funcition that uses ajax. this works on the first time run, does not work after. It keeps passing the full list and not the updated list. Any idea how to fix?
[jQuery] Re: saving values from a multi select list.
With Pleasure. === first post Im using a plugin called selectchain by Remy Sharp and modified it a bit. Right now im trying to pass only selected values of a multi select list through ajax. The following function does a bit more but im concerned with the part that says cust_val: customer.val().join(",") This should return only selected values. This is what happens if i put it in an alert(). however when i check firebug to see what was posted it shows the entire list. I've tried alternatives like option:selected they all work for alet() .. but the info passed through ajax shows the entire list. please help. customer.selectChain({ target: market, url: callback_url, type: "POST", data: { ajax: true, multsel: market_selects, cust_val: customer.val ().join(",") } }).trigger('change'); = Second Post = Ok so i thought that maybe the problem had something to do with the ajax request so i tried adding the ajaxStart function. See below. $("#ddl_customer").change(function(){ $("#ddl_customer").ajaxStart(function() { cuslist = $(this).val().join(", "); }); alert(cuslist); }); $("#ddl_customer").selectChain({ target: market, url: callback_url, type: "POST", data: { ajax: true, multsel: market_selects, cust_val: cuslist } }).trigger('change'); So im trying to get all the selected values from ddl_customer in the first block of code. then pass it to cust_val in the second block of code. note that the alert(custlist) outputs what i expect. but when i check cust_val in firebug it outputs the entire list, not only selected values. Please Help!:(
[jQuery] Re: saving values from a multi select list.
Still stuck on this.no one has even a suggestion as to what maybe wrong?
[jQuery] Re: saving values from a multi select list.
Ok so i thought that maybe the problem had something to do with the ajax request so i tried adding the ajaxStart function. See below. $("#ddl_customer").change(function(){ $("#ddl_customer").ajaxStart(function() { cuslist = $(this).val().join(", "); }); alert(cuslist); }); $("#ddl_customer").selectChain({ target: market, url: callback_url, type: "POST", data: { ajax: true, multsel: market_selects, cust_val: cuslist } }).trigger('change'); So im trying to get all the selected values from ddl_customer in the first block of code. then pass it to cust_val in the second block of code. note that the alert(custlist) outputs what i expect. but when i check cust_val in firebug it outputs the entire list, not only selected values. Please Help!:(
[jQuery] Re: saving values from a multi select list.
Thanks for the reply. I'm not really too concerned about html and how its displayed right now. I'm just concerned that its not passing the right data to the ajax call. It's also part of a much larger mvc type program so its hard to show html. this is what the html for the drop down list looks like. It has some framework specific stuff in there. also in the javascript im setting ddl_customer to customer like the following. var customer = $('#ddl_customer'); also id I do the following.. the alert gives only selected values... which is what i want if i do the same thing in the ajax call i get the entire list. customer.change(function(){ cuslist = customer.val().join(", "); }); alert(cuslist);
[jQuery] saving values from a multi select list.
Im using a plugin called select chain and modified it a bit. Right now im trying to pass only selected values of a multi select list through ajax. The following function does a bit more but im concerned with the part that says cust_val: customer.val().join(",") This should return only selected values. This is what happens if i put it in an alert(). however when i check firebug to see what was posted it shows the entire list. I've tried alternatives like option:selected they all work for aler() .. the info passed through ajax shows the entire list. please help. customer.selectChain({ target: market, url: callback_url, type: "POST", data: { ajax: true, multsel: market_selects, cust_val: customer.val().join(",") } }).trigger('change');
[jQuery] Re: set certain items in a select list to selected.
Not exactly. I guess looping through my string would work. but its a multiple select list so .addclass wont work i tried using $("#mylist option:contains(3)").attr("selected", "selected"); this compares against the list value, not the id. Is there a way to compare against the id? Better yet, us there a function that will let me drop in my string and will simply find all the ids that match and then i can use .attr ("selected", "selected"); on that?
[jQuery] set certain items in a select list to selected.
Ok lets say i have a multiple select list first second third fourth fifth then i have a string of id's that i want to set to selected like so. var selectedIds = '1,3,5'; is it possible to use jquery (preferably in a one liner) to set first, third and fifth to selected.?
[jQuery] Re: Filtering a select list
@mkmanning many thanks!! All i needed to do is add a text box with a keyup event and change the regular expression to match everything and not just the first beginning of the last name. Here is the solution in case anyone else is searching. Thanks again. http://code.jquery.com/jquery-latest.js";> $(document).ready(function(){ //cache the original select and options var selList = $('select'), opts = selList.find('option'); //filters by first letter of last name as option text function filterList(ltr){ selList.empty(); if(ltr==='All' || ltr==''){ selList.append(opts); return; } // var re = new RegExp("^"+ltr,"i");//, newopts = ''; var re = new RegExp(ltr,"i"); $.each($.grep(opts,function(o,i){return re.test($ (o).text());}), function(){ selList.append(this); }); } $('#search').keyup(function(){ filterList( $('#search').val() ); }); }); Bellucci, Monica Bernhardt, Daniel Chou, Collin Fishburne, Laurence Gaye, Nona Hulme, Lachy Lees, Nathaniel Lennix, Harry J. McColm, Matt Moss, Carrie-Anne O'Reilly, Genevieve Perrineau, Harold Jr. Pinkett Smith, Jada Rayment, Adrian Rayment, Neil Reeves, Keanu Spence, Bruce Weaving, Hugo Wilson, Lambert Wong, Anthony
[jQuery] Filtering a select list
here is a non jquery solution to what i'm looking for. http://www.barelyfitz.com/projects/filterlist/index.php/1 Does anyone know of jquery plugin to do the same or maybe if its easy, some quick source code? thanks
[jQuery] Re: how to ask questions
its not always practical to post a link. The stuff im working on is offline for now. including database and php files. but thanks for all the tips.
[jQuery] filtering a multiple select box
i would like to filter out option on an select box as i type my value in a textbox. I would work sorf of like autocomplete without the autocompleting part. Its implemented here but the code seems is very complex as there are many other things going on. http://www.headcircus.com/uiguy/selectboxfactory/selectboxfactory.html I just want it on a plain select box. does this sound easy or would it require several lines of code?
[jQuery] Re: how can i set the attribute of an item in a select box to selected?
ravi, matthew, thanks for the responses, and i totally agree that this group is huge. Google could have added a few more features to their groips app. this is very barebones:( here is what im doing, i've been using this (http://remysharp.com/2007/09/18/auto-populate- multiple-select-boxes/) plugin to chain several multiple select boxes where the input from the previous populates values in the next. so far with lots of tweaks and additions it seems to be doing what i want. i have it selecting all values from the next box each time one or more values from the current box is selected. I'd like to add a select all option to the head of each list that would automatically select all options when selected. sounds trivial, but this is my first jquery/ajax project
[jQuery] Re: select all values of a multiple select list
thanks, charlie, jquery feels like such a puzzle, and i get bits and pieces from everywhere. Can we take this to another level? what if i want to have a first element in the list, example --select all--, how do i set it so when this is selected, all values get selected. On Jun 23, 11:55 am, Charlie wrote: > $("#yourSelect option").attr("selected","selected");shadedwrote:is there a > way to select all values of a multiple select list by default?
[jQuery] Re: how to ask questions
thanks for the replies, @cesar, i'm not mad or anything, i just figure i was asking in the wrong way and wanted to find out what im doing wrong. @michael, thanks for pointing out that 2 questions were answered. This is my first google group and i figured that replies to my post would be emailed to me. maybe i can set that up in settings or something.
[jQuery] how to ask questions
ok , ive posted about 6 questions in this group since i joined and not one has answered. not even an attempt. I've seen question, both easier and more difficult that mine being answered. Am i asking in the wrong way? Is there something im forgetting to include? what can i do to make my question more likely to be answered?
[jQuery] Re: how can i set the attribute of an item in a select box to selected?
ok , ive posted about 6 questions in this group since i joined and not one has answered. not even an attempt. I've seen question, both easier and more difficult that mine being answered. Am i asking in the wrong way? Is there something im forgetting to include? what can i do to make my question more likely to be answered?
[jQuery] how can i set the attribute of an item in a select box to selected?
how can i set the attribute of an item in a select box to selected?
[jQuery] Re: Problem with loading SELECT on change of other select
here i've been working with this for the past few days. it should do the trick http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/ On Jun 23, 2:44 pm, Paul wrote: > Hi there, > > This is what I'm trying to do: > > When a user selects a group in the first SELECT box, another SELECT > box should be loaded from an external PHP-file (using MySQL), based on > the group-id of the first SELECT box. > > I use this code: > > $('#kiesgroep').change(function(){ > $.post("php/kies_speltak.php", { > groepid: $('#kiesgroep').val() > }, function(response){ > $('#kiesspeltakveld').fadeOut(); > setTimeout("finishAjax('kiesspeltakveld', '"+escape(response) > +"')", 200); > }); > return false; > }).change(); > > function finishAjax(id, response) { > $('#'+id).html(unescape(response)); > $('#'+id).fadeIn(); > > } //finishAjax > > where #kiesspeltakveld is the field where the second SELECT box should > be loaded, > and #kiesgroep is the id of the first SELECT box. > But now the problem is that the second SELECT box gets loaded when the > page loads, NOT when the first SELECT box gets changed. Does anyone > know why?
[jQuery] select all values of a multiple select list
is there a way to select all values of a multiple select list by default?
[jQuery] triggering multiple events
is is possible to trigger mutiple events in sucession? each depending on the previous?
[jQuery] using multiple triggers with ajax
i have 5 multiple select boxes each of which get populated when the previous box is clicked on. ex. i select a value from box 1 that populates box 2 then i select box 2 that populates box 3 etc. is it possible to have them all populate with out the clicking. ex. i click in box 1 and box 2, gets populated, box 3 get populated based on the new box 2 value etc. I'm using Shelane's plugin: http://code.google.com/p/jqueryselectcombo/ http://lasso.pro/selectCombo/ here is he code that calls the plugin $(function(){ $('#ddl_market').selectCombo('url?setval=true', '#ddl_zone', {hidetarget: false} ); $('#ddl_zone').selectCombo('url?setval=true', '#ddl_customer', {hidetarget: false} ); $('#ddl_customer').selectCombo('url?setval=true', '#ddl_group', {hidetarget: false} ); $('#ddl_group').selectCombo('url?setval=true', '#ddl_store', {hidetarget: false} ); }); they are all ajax calls the entire page does not reload.
[jQuery] fun with check boxes.
I'm tasked with created a series of filters with checkboxes. for example lets say i have 3 categories, customers, groups, acccount customers contains groups and groups contain accounts. i want to be able all records as checkboxes in 3 different sliding panels on the same page. Then as any checkbox is checked, it automatically filters everything else. for example if i check a customer it will filter out the groups and accounts. or if i check an account it will filter out the customers and groups etc. im using php/mysql and i assume jquery is the best tool for this... problem is im a relative newbie. Can anyone point me in the right direction to get started. ?
[jQuery] Re: Obtaining the *key* on selecting rather than the *display name*
I suppose you can switch key and value On Jun 16, 8:02 am, Sanjay Khandkar wrote: > Hi, > > I was able to obtain the key or display name from autocomplete list > using your example of "email". > > The problem is this > > a. Search should take place on the "display" field (in the name field > - row.name) > b. Display item in the textbox should be the "display field again (the > name field - row.name) > c. The value in the "results" div should be the key field (the email > field - row.to). > > While this looks like a trivial problem - I am unable to get this > behavior from your example. > > Can you please help?
[jQuery] [autocomplete]
im a newbie trying to use the autocomplete plugin. I have a php array returning a name and an id. the autocomplete drop down displays only the first value before the | in name|id This is fine but how do i get the 'id' part to be stored in a hidden field. I've looked at the examples herehttp://view.jquery.com/trunk/plugins/autocomplete/demo/ and it seems single bird does what i need, but im not sure how the hidden field get populated. please help thanks.