Pretty straightforward:

Your session variable is a comma-delimited list, so use listContains to find out if a list element matched your FORM.redirect variable (ListContains value of what list element - the first instance - that matches)

Faking your code, here is how you can do it:

<cfset SESSION.Display = "D:\mywork\dir1,D:\documents\dir1,D:\mywork\dir2,D:\documents\dir2,D:\mywork\dir3,D:\mywork\dir4,D:\mywork\dir5,D:\documents\dir3">
<cfset FORM.redirect = "dir3">
<cfoutput>
<cfif listContainsNoCase(session.display, FORM.redirect)>
<cfset FORM.redirect = ListGetAt(session.display, listContainsNoCase(session.display, FORM.redirect))>
form.redirect = #FORM.redirect#
<cfelse>
NO match, so do something else...
</cfif>
</cfoutput>

Hope that helps...

>Hi,
>
>I need to check a SESSION variable for an occurence and then pluck out
>the string. For example, below is the contains of my session variable
>
>SESSION.Display = D:\mywork\dir1,D:\documents\dir1,D:\mywork\dir2,
>D:\documents\dir2,D:\mywork\dir3,D:\mywork\dir4,D:\mywork\dir5,
>D:\documents\dir3
>
>I have a form where I would type in the directory name (ex. dir3) and
>then my app would take me to that directory.
>
>The directory gets passed as FORM.redirect when its submitted.
>
>So...I need to check to see if "dir3" in the FORM.redirect variable
>exists in the SESSION.Display variable. If it exists then make the
>FORM.redirect equal to
>
>FORM.redirect = D:\mywork\dir3
>
>Note that there will be other directories in the SESSION.Display with
>different paths so basically I need to pluck out everything (reading
>back) up to the D:\ when the
>FORM.redirect match is found.
>
>D:\mywork
>Can this be done. If so....how?
>
>
>
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to