JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 1st, 2012, 07:15 AM
saintaw's Avatar
saintaw saintaw is offline
Lurker - in your bushes
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Location: .be
Posts: 494 saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 21 h 11 m 20 sec
Reputation Power: 115
JQuery UI: autocomplete with options:selected

Dear Devshed denizens,

I want to use an autocomplete on an input field, and select what sort of table/data it pulls WRT the dropdown that follows it:


html:
PHP Code:
<input type="text" name="quicksearch" id="quicksearch" value="Search candidates"  />
<
br />        
<
select name="quicksearch_type" id="quicksearch_type" onChange="LoadQSHiddn();">
            <
option value="cand_id">Candidate ID</option>
            <
option value="username">Username/Login</option>
            <
option value="pers_id">Personal Nr</option>
            <
option value="cname">Current Name</option>
            <
option value="lname">Family name at birth</option>
            <
option value="fname">First Name</option>
            <
option value="email">Email</option>
            
        </
select>
        <
input type="hidden" id="hiddn_qs_type" value="cand_id" readonly />

<
script type="text/javascript">
//temp function to copy the value of quicksearch_type into the value field of #hiddn_qs_type

function LoadQSHiddn()
        {
        var 
t_val = $('#quicksearch_type option:selected').val();
        $(
'#hiddn_qs_type').val(t_val);    
        }

//load autocomplete with the type selected from the dropdown (copied in the hidden field)    
$(function() {
    $( 
"#quicksearch" ).autocomplete({source"./inc/inc_quicksearch.cfm?filter=" +$('#hiddn_qs_type').val(),minLength2});    
    });
    
</script> 


My problem is that no matter what I select in the dropdown, it's always set as: cand_id (which was the selected field when the page loaded)
__________________
Saintaw

pending.

Reply With Quote
  #2  
Old October 1st, 2012, 08:54 AM
saintaw's Avatar
saintaw saintaw is offline
Lurker - in your bushes
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Location: .be
Posts: 494 saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level)saintaw User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 21 h 11 m 20 sec
Reputation Power: 115
Sorted (ugly)

I placed the autocomplete call insite the function:

Code:
	function LoadQSHiddn()
		{
		var t_val = $('#quicksearch_type option:selected').val();
		$('#hiddn_qs_type').val(t_val);	
		$( "#quicksearch" ).autocomplete({source: "./inc/inc_quicksearch.cfm?filter=" +$('#hiddn_qs_type').val(),minLength: 3});
		}

	//call it by default
	$(function() {
	$( "#quicksearch" ).autocomplete({source: "./inc/inc_quicksearch.cfm?filter=" +$('#hiddn_qs_type').val(),minLength: 3});	
	});

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > JQuery UI: autocomplete with options:selected

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap