Solved

How to show a  OPTION values at  top in drop-down  list box form control?

Posted on 2002-03-29
3
146 Views
Last Modified: 2013-12-24
In the CFSELECT tag, First I am using a sybase query and then I use OPTION value. The OPTION value is always in botton in the drop-down list box. But my requirement is that OPTION value should be top of drop-down list box.

Could you some help me how to show up a Option value (The hardcoded one "ALL") at top?

Thanks in advance.

Pls have a look at the below code :


<CFQUERY NAME="SelAcct" DATASOURCE="#CSybDataSource#" USERNAME=#CSybUsername# PASSWORD=#CSybPassword#>
SELECT      distinct cUprFSACode
FROM     tblFSAAcctNameJa
ORDER BY cUprFSACode
</CFQUERY>

<CFQUERY NAME="SelDBFN" DATASOURCE="#CSybDataSource#" USERNAME=#CSybUsername# PASSWORD=#CSybPassword#>
SELECT      distinct cDBFN
FROM     tblDBFN
where cDBFN != ' '
order by cDBFN desc
</CFQUERY>

<HTML>
<HEAD>
     <TITLE>ABCD - Menu</TITLE>
     <SCRIPT LANGUAGE="JavaScript">

</SCRIPT>
</HEAD>

<BODY BGCOLOR="#DDDDFF" background="http://ap.dweb.it.db.com/images/topbar_back.gif">

<CFFORM NAME="form" ACTION="ABCDList.cfm" TARGET="main">
<TABLE BORDER="0">
          <TR>
               <TD> 
               <TD>
               <CFSELECT NAME="AcctList"
                        QUERY="SelAcct"
                        VALUE="cUprFSACode"
                        DISPLAY="cUprFSACode"
                        REQUIRED="yes"
                        SIZE="1">
                    <OPTION value="ALL">ALL
               </CFSELECT>
               </TD>
               <TD>
               <CFSELECT NAME="DBFNList"
                        QUERY="SelDBFN"
                        VALUE="cDBFN"
                        DISPLAY="cDBFN"
                        REQUIRED="yes"
                        SIZE="1">
               <OPTION value="ALL">ALL
               </CFSELECT>
               </TD>
               </TD>
               <TD>
                                <INPUT TYPE="submit" NAME="Go" Value="Go" ><font color="red"></font>
                                <INPUT TYPE="radio" NAME="ViewType" Value="Browser" CHECKED><font color="white">In Browser</font>
                    <INPUT TYPE="radio" NAME="ViewType" Value="Excel"><font color="white">Excel Download</font>
               </TD>
          </TR>
</TABLE>
</CFFORM>

</BODY>

</HTML>
0
Comment
Question by:cmurugavel
  • 3
3 Comments
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 6905016
Intead of

<CFSELECT NAME="AcctList"
                       QUERY="SelAcct"
                                              REQUIRED="yes"
                       SIZE="1">
                 
</CFSELECT>

Do this.(It should work...)

<cfoutput>
<CFSELECT name="droplist1" value="ALL">
<CFLOOP query="SelAcct">
   <OPTION VALUE="#cUprFSACode#" DISPLAY="#cUprFSACode#">
</cfloop>
</CFSELECT>
</cfoutput>

Hope this helps..

Sincerely,

Racimo



0
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 6905030
Sorry Ignore my previous message replace

<CFSELECT NAME="AcctList"
   QUERY="SelAcct"
   VALUE="cUprFSACode"
   DISPLAY="cUprFSACode"
   REQUIRED="yes"
   SIZE="1">
   <OPTION value="ALL">ALL
</CFSELECT>
..BY....

<cfoutput>
<CFSELECT name="AcctList" value="ALL" value="ALL">
<CFLOOP query="SelAcct">
  <OPTION VALUE="#cUprFSACode#" DISPLAY="#cUprFSACode#">
</cfloop>
</CFSELECT>
</cfoutput>

AND...
<CFSELECT NAME="DBFNList"
   QUERY="SelDBFN"
   VALUE="cDBFN"
   DISPLAY="cDBFN"
   REQUIRED="yes"
  SIZE="1">
  <OPTION value="ALL">ALL
</CFSELECT>
BY..
<cfoutput>
<CFSELECT name="DBFNList" value="ALL" value="ALL">
<CFLOOP query="SelDBFN">
  <OPTION VALUE="#cUprFSACode#" DISPLAY="#cUprFSACode#">
</cfloop>
</CFSELECT>
</cfoutput>

This tiem it should be OK...
Sincerely,

Racimo

0
 
LVL 23

Accepted Solution

by:
Racim BOUDJAKDJI earned 15 total points
ID: 6905037
More easily paste this...

<CFQUERY NAME="SelAcct" DATASOURCE="#CSybDataSource#" USERNAME=#CSybUsername# PASSWORD=#CSybPassword#>
SELECT      distinct cUprFSACode
FROM     tblFSAAcctNameJa
ORDER BY cUprFSACode
</CFQUERY>

<CFQUERY NAME="SelDBFN" DATASOURCE="#CSybDataSource#" USERNAME=#CSybUsername# PASSWORD=#CSybPassword#>
SELECT      distinct cDBFN
FROM     tblDBFN
where cDBFN != ' '
order by cDBFN desc
</CFQUERY>

<HTML>
<HEAD>
    <TITLE>ABCD - Menu</TITLE>
    <SCRIPT LANGUAGE="JavaScript">

</SCRIPT>
</HEAD>

<BODY BGCOLOR="#DDDDFF" background="http://ap.dweb.it.db.com/images/topbar_back.gif">

<CFFORM NAME="form" ACTION="ABCDList.cfm" TARGET="main">
<TABLE BORDER="0">
         <TR><TD>
             <CFOUTPUT>
              <TD>
              <CFSELECT name="AcctList" value="ALL"   DISPLAY="ALL">
<CFLOOP query="SelAcct">
 <OPTION VALUE="#cUprFSACode#" DISPLAY="#cUprFSACode#">
</cfloop>
</CFSELECT>
             </TD>
              <TD>
             <CFSELECT name="DBFNList" value="ALL"  display="ALL">
<CFLOOP query="SelDBFN">
 <OPTION VALUE="#cDBFN#" DISPLAY="#cDBFN#">
</cfloop>
</CFSELECT>
              </TD>
             </CFOUTPUT>
              </TD>
              <TD>
                               <INPUT TYPE="submit" NAME="Go" Value="Go" ><font color="red"></font>
                               <INPUT TYPE="radio" NAME="ViewType" Value="Browser" CHECKED><font color="white">In
Browser</font>
                   <INPUT TYPE="radio" NAME="ViewType" Value="Excel"><font color="white">Excel Download</font>
              </TD>
         </TR>
</TABLE>
</CFFORM>

</BODY>

</HTML>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now