Search the web
Sign In
New User? Sign Up
cfajax
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
cfajax and multiple drop down lists   Message List  
Reply | Forward Message #2014 of 2032 |
RE: [cfajax] cfajax and multiple drop down lists

You might find it easier to switch to mxAjax as the codebase is newer, I’ve had far less issues with mxAJax than I did trying cfAjax

 

http://www.indiankey.com/mxAjax/

 

 

 

From: cfajax@yahoogroups.com [mailto:cfajax@yahoogroups.com] On Behalf Of saturness1
Sent: 28 April 2008 15:58
To: cfajax@yahoogroups.com
Subject: [cfajax] cfajax and multiple drop down lists

 

I'm going to start off by saying that I am a brand new user of
cfajax. I'm working on an application that already has cfajax to
populate a single drop down list and i'm using this code. I am trying
to create a form with 3 recursive calls to the database which
populates the drop down lists.

The attached code is just my starting point. I'm trying to get the
first drop down list activate the code to populate the second drop
down list but i'm having no luck. And since i'm not receiving an
error message it's difficult to figure out why nothing is happening.

Anybody have a thought as to what i'm missing? Or know a website that
can assist me in this?

Any help is greatly appreciated. Thanks in advanced!

Jennifer

Attached Code:
__________________________________________________________

<script language="JavaScript" type="text/javascript">

function getBuyNames() {
var PlanFilter = DWRUtil.getValue("planName");
var username =
<cfoutput>'#session.username#'</cfoutput>;
var accesslevel =
<cfoutput>#session.accesslevel#</cfoutput>;
var fuseaction =
<cfoutput>'#URL.fuseaction#'</cfoutput>;
var arglist = PlanFilter + "," + username + "," +
accesslevel + "," + fuseaction;
DWREngine._execute(_cfscriptLocation,
null, 'buyNamelookup', arglist, getBuyNameResult);
}

function getBuyNameResult(buyArray){
DWRUtil.removeAllOptions("buyName");
DWRUtil.addOptions("buyName",
buyArray, "KEY", "VALUE");
}
</script>
__________________________________________________________
<cffunction name="buyNamelookup">
<cfargument name="arglist" required="yes" type="string">
<cfargument name="returnType" required="no">
<cfparam name="returnType" default="array">

<cfset PlanFilter=ListGetAt(arglist,1)>
<cfset username=ListGetAt(arglist,2)>
<cfset accesslevel=ListGetAt(arglist,3)>
<cfset fuseaction=ListGetAt(arglist,4)>

<cfquery name="selectBuyNames" datasource="#DSN#">
SELECT DISTINCT buyName
FROM tblAtlasStruct
WHERE 0=0
AND planName = '#PlanFilter#'
ORDER BY buyName
</cfquery>

<!--- Creates List of buyNamess --->
<cfset List_selectbuyName = ValueList
(selectBuyNames.buyName,"¬")>

<!--- Create Key/Value Pair List --->
<cfset valueTextList="">
<cfset i=1>
<cfloop list="#List_selectbuyName#" index="ListElement"
delimiters="¬">
<cfif i EQ 1>
<cfset nextPlan=ListGetAt
(List_selectbuyName,i,"¬")>
<cfset nextPlan_r=Replace(nextPlan,",","-
","ALL")>
<cfset valueTextList= nextPlan_r & "¬ " &
nextPlan_r & "^">
<cfelse>
<cfset nextPlan=ListGetAt
(List_selectbuyName,i,"¬")>
<cfset nextPlan_r=Replace(nextPlan,",","-
","ALL")>
<cfset valueTextList= ListAppend
(valueTextList, nextPlan_r & "¬ " & nextPlan_r, "^")>
</cfif>
<cfset i=i+1>
</cfloop>

<cfset valueTextList="0¬ All Buy Names loaded. Select a Buy
Name.^All¬ All^" & valueTextList>

<cfset valueTextList_conv=Replace(valueTextList,"¬",",","ALL")
>

<!--- Initialize Arrays --->
<cfset BuyNameArray = ArrayNew(1)>
<!--- Convert the List to an Array --->
<cfset BuyNameArray = ListToArray(valueTextList_conv,"^")>

<cfreturn BuyNameArray>

</cffunction>

<cfform method="post" name="Atlas" action="">
<table>
<tr>
<td>Plan Name:</td>
<td><select id="planName" name="planName" size="1"
onChange="getBuyNames();">
<option value="">Select Plan Name</option>
<cfoutput query="getplanName">
<option
value="#planName#">#planName#</option>
</cfoutput>
</select> </td>
</tr>
<tr>
<td>Buy Name:</td>
<td><select id="buyName" name="buyName" size="1"
onChange="getSiteNames();">
<option value=""></option>
</select></td>
</tr>
<tr>
<td>Site Name:</td>
<td><select id="siteName" name="siteName" size="1"
onChange="getPlacements();">
<option value=""></option>
</select></td>
</tr>
<tr>
<td valign="top">Placement:</td>
<td><select id="placementName" name="placementName"
multiple size="10">
<option value=""></option>
</select></td>
</tr>
</table>
</cfform>



Tue Apr 29, 2008 8:30 am

jumperb
Offline Offline
Send Email Send Email

Attachment
image001.jpg
Type:
image/jpeg
Attachment
image002.jpg
Type:
image/jpeg
Forward
Message #2014 of 2032 |
Expand Messages Author Sort by Date

I'm going to start off by saying that I am a brand new user of cfajax. I'm working on an application that already has cfajax to populate a single drop down...
saturness1
Offline Send Email
Apr 28, 2008
4:25 pm

You might find it easier to switch to mxAjax as the codebase is newer, I’ve had far less issues with mxAJax than I did trying cfAjax ...
Edward Chanter
jumperb
Offline Send Email
Apr 29, 2008
8:30 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help