Hello All:

Optimize code question. The code below has the field names in the SWITCH 
statement. Can anyone modify this script to dynamically populate the 
parsed values for each for field name? I want to make this code reusable 
so it doesnt have to be modified to use with each form action page that 
will use the code.

A big thank you to Gerry Pauline for whipping up this code!

Regards,
James Blaha



<CFSCRIPT>

URL =
"http://127.0.0.1/Example.cfm?DayOfWeek=Mon&DayOfWeek=Tue&day=1&day=2&Month=Feb&Submit=Search";
;
UrlPairs = ListGetAt(URL, 2, '?') ;


T = 1 ;
Value = "" ;
Pairs = Replace(UrlPairs, "&", " ", "ALL") ;
LoL = ListLen(Pairs, " ") - 1 ;

vSel = "" ;
vDay = "" ;
vMon = "" ;

while (T LTE LoL)
{
cToken = ListGetAt(Pairs, T, " ") ;
nToken = ListGetAt(cToken, 1, "=") ;
vToken = ListGetAt(cToken, 2, "=") ;

switch (nToken)
{
case "DayOfWeek": vSel = vSel & ' ' & vToken ;
break ;
case "day": vDay = vDay & ' ' & vToken ;
break ;
case "Month": vMon = vMon & ' ' & vToken ;
}

T = T + 1 ;
}

WriteOutput("DayOfWeek Is " & vSel & "<P>" &
"Day Is " & vDay & "<P>" &
"Month Is " & vMon) ;

</CFSCRIPT>


<HR>
<br><br>

<cfoutput>Day of the week: #vSel#</cfoutput>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to