?
Solved

If on a specific page, show different options in pull down menu

Posted on 2004-10-22
13
Medium Priority
?
210 Views
Last Modified: 2013-12-24
I have a pulldown menu that allows the user to select the page they want to see next. However, i do not want to show the option for the page they are currently on. How might i code this?

-------

Psuedo, if on page, type2, do not show the option type2.

Ex.
<cfform action="AHprocess.cfm" method="post">
      <select name="Specify">
        <option value="All" selected>All Classes</option>
        <option value="type1">Residential</option>
        <option value="type2">Commercial</option>
        <option value="type3">Multi Family</option>
        <option value="type4">Land</option>
        <option value="type5">Rentals</option>
        <option value="type6">For Lease</option>
      </select>
      <input type="submit" value="Refresh">
    </cfform>
0
Comment
Question by:zakirdavis
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 12387044
well if that is the case and this are static variables and not comming from query then I see only one way to do it...
<cfparam name = "AHProcess.cfm" default="">
<cfform action="AHprocess.cfm" method="post">
      <select name="Specify">
        <option value="All" selected>All Classes</option>
        <cfif form.AHprocess.cfm eq 'type1'><cfelse><option value="type1">Residential</option></cfif>
        <cfif form.AHprocess.cfm eq 'typ21'><cfelse><option value="type2">Commercial</option></cfif>
        <cfif form.AHprocess.cfm eq 'type3'><cfelse><option value="type3">Multi Family</option></cfif>
        <cfif form.AHprocess.cfm eq 'type4'><cfelse><option value="type4">Land</option></cfif>
        <cfif form.AHprocess.cfm eq 'type5'><cfelse><option value="type5">Rentals</option></cfif>
        <cfif form.AHprocess.cfm eq 'type6'><cfelse><option value="type6">For Lease</option></cfif>
      </select>
      <input type="submit" value="Refresh">
    </cfform>

something like this... but I am assuming that this the values when the form is submitted... if you are controling your pages by url then replace the form by url or any other variable which is apropriate.
This is the idea.
Regards,
---Pinal
0
 
LVL 17

Expert Comment

by:anandkp
ID: 12387167
I think it shld be

<CFPARAM NAME="form.Specify" DEFAULT="">

<cfif form.Specify neq 'type1'><option value="type1">Residential</option></cfif>
<cfif form.Specify neq 'type2'><option value="type2">Commercial</option></cfif>
<cfif form.Specify neq 'type3'><option value="type3">Multi Family</option></cfif>
...
..
.

PS : I wld suggest that u shld the option as selected [instead of hiding it] - so the user knows which page hes looking at !
eg : <option value="type1" <cfif form.Specify eq 'type1'> SELECTED </CFIF>>Residential</option>

K'Rgds
Anand
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12387185
>>PS : I wld suggest that u shld the option as selected [instead of hiding it] - so the user knows which page hes looking at !
>>eg : <option value="type1" <cfif form.Specify eq 'type1'> SELECTED </CFIF>>Residential</option>

I should have said the same before. If it is not requirement of hiding then just do it.
Anandkp buddy this should not be in PS that it should be title. I do the same all the time.
---Pinal
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
LVL 17

Expert Comment

by:anandkp
ID: 12387196
Didnt get u Pinal !
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12387220
okey, I mean that your suggestion of keeping that selected is professional and practical. That is good to do.
I mean if user have no specific requirement then do not hide them and keep them selected as you have suggested Anand!!! ( I like your suggestion)
Regards,
---Pinal
0
 

Author Comment

by:zakirdavis
ID: 12387223
Basically what i wanted to do it make an IF statement that captures the URL that the user is currently looking at, and display the pulldown menue depending on the URL.

Ex.

If user is on the url http://www.site.com/RES.cfm

then show only Multi, Comm, Lease, Land.....

If user is on the url http://www.site.com/Comm.cfm
then show only Multi, Res, Lease, Land....

This is what i was looking for, as I am not passing variables in my URL.

---
Sample code of my process page:
---

<cfif #Form.Specify# EQ "res">
  <script>
       self.location="res.cfm";
    </script>
  <cfelseif #Form.Specify# EQ "multi">
  <script>
       self.location="multi.cfm";
    </script>
  <cfelseif #Form.Specify# EQ "land">
  <script>
       self.location="land.cfm";
    </script>
  <cfelseif #Form.Specify# EQ "comm">
  <script>
       self.location="comm.cfm";
    </script>
  <cfelseif #Form.Specify# EQ "rent">
  <script>
       self.location="rent.cfm";
    </script>
  <cfelseif #Form.Specify# EQ "lease">
  <script>
       self.location="lease.cfm";
    </script>
  <cfelseif #Form.Specify# EQ "all">
  <script>
       self.location="index.cfm";
    </script>
  <cfelse>
  <script>
        alert("Going to index.cfm");
        self.location="index.cfm";
    </script>
</cfif>

<!--- All of the above pages (res.cfm, multi.cfm...) have an include file that shows the same Pull-Down Menue (shown above) --->
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12387227
My suggestions not good as Anand's suggestion that is what i wrote above.
0
 

Author Comment

by:zakirdavis
ID: 12387260
I tried Anands. Didnt do what i wanted. I want it to check the current url of the page and not check the form data.
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12387285
okey buddy then change form.variable to url.variable in Anand's suggestion. it shoudl work.
0
 
LVL 8

Accepted Solution

by:
sigmacon earned 1000 total points
ID: 12387407
to determine the template your on and to paint a drop down that forwards to a new page when you select one, your include file should look something like this:

<!--- determining the template that was called --->
<cfparam name="cgi.SCRIPT_NAME" default="index.cfm">
<cfif find('/', cgi.SCRIPT_NAME) eq 1>
      <cfset currentTemplate = right(cgi.SCRIPT_NAME, len(cgi.SCRIPT_NAME) - 1)>
<cfelse>
      <cfset currentTemplate = cgi.SCRIPT_NAME>
</cfif>

<cfset templates = 'res.cfm,multi.cfm,land.cfm,comm.cfm,rent.cfm,lease.cfm,index.cfm'>
<cfif not listFind(templates, currentTemplate)>
      <cfset currentTemplate = 'index.cfm'>
</cfif>


<!--- painting the navigation drop-down --->
<cfset templates = listToArray(templates)>
<cfset names = listToArray('Residential,Multi Family,Land,Commercial,Rent,For Lease,Home')>
<cfset numFiles = arrayLen(templates)>

<form method="index.cfm">
      <select name="Specify" size="1" onChange="if (this.value != 'dummy') self.location=this.value;">
            <option value="dummy">Select a page:</option>
            <cfloop index="i" from="1" to="#numFiles#">
                  <cfif templates[i] neq currentTemplate>
                  <cfoutput><option value="#templates[i]#">#names[i]#</option></cfoutput>
                  </cfif>
            </cfloop>
      </select>
</form>
0
 
LVL 17

Assisted Solution

by:anandkp
anandkp earned 1000 total points
ID: 12387513
<CFSET CurrPage = ListLast(Script_name,'/')> <!-- determines ur current page -->

<cfif CurrPage neq 'res.cfm'><option value="res.cfm">Residential</option></cfif>
<cfif CurrPage neq 'com.cfm'><option value="com.cfm">Commercial</option></cfif>
<cfif CurrPage neq 'multi.cfm'><option value="multi.cfm">Multi Family</option></cfif>
...
..
.

wld that help ?
lemme know ...
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This installment of Make It Better gives Media Temple customers the latest news, plugins, and tutorials to make their VPS hosting experience that much smoother.
The following information will get you familiar with your new DV server, including the (mt) Account Center, the Plesk Control Panel, our world-renowned support department and the rest of the (mt) tools that come with your new service.
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question