[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2004-10-22
13
Medium Priority
?
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
13 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
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 
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

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

650 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