?
Solved

Drop down list

Posted on 2009-05-18
12
Medium Priority
?
276 Views
Last Modified: 2013-12-16
How to code for different datasource by using drop down list? Let's say i got one datasource and i'm searching for an drawing number..

I want the drop down list to show the database name and enable user to choose it(i.e. Database: Lardon2, dbl_IWS, etc..), after that key in the drawing number so that the particular drawing number will be shown in the results page.

Base on my code shown:
<cfparam name="url.pageno" default="1">
<cfparam name="url.pageSize" default="30">
<cfset pageSize = max(val(url.pageSize),10)> 
<cfset pageNo = max(val(url.pageNo),1)> 
<CFset index="1">
<cfparam name="form.txtBoxValue" default="">
 
 
<cfset variables.data = arrayNew(1)> 
 
<cfif isDefined("form.txtBoxValue") and len(form.txtBoxValue)>
 
  <cfset allTableNames = "335K,335L,335M,335N, 310A,310B,310C,310D">  
 
 
  <cfset allLardonTableNames = "LAA, LCA, LCB, LCC, LCD, LCJ. LCT">  
 
<!---IWS TABLE--->
  <cfloop index="IWSTable" list="#allTableNames#"> 
    <cfquery name="get_ALL" DATASOURCE="DSN_dbl_IWS">       
     SELECT Doc_No, Remarks, Status, Describe
     FROM #IWStable#
     WHERE Doc_No LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#form.txtBoxValue#%">
    </cfquery>
  
    <cfloop query="get_ALL"> <!--- loop through the results, adding the results to the results array ----->
       <cfset pos = arrayLen(ALL.data) + 1>
       <cfset ALL.data[pos] = structNew()>
       <cfset ALL.data[pos].doc_no = get_ALL.doc_no>    
       <cfset ALL.data[pos].Remarks =get_ALL.Remarks>    
       <cfset ALL.data[pos].Status = get_ALL.Status>    
       <cfset ALL.data[pos].Describe = get_ALL.Describe>    
       <cfset ALL.data[pos].tableName = IWStable>
    </cfloop>
 </cfloop>
 
 
<!---LARDON 2 TABLE--->
    <cfloop index="LardonTable" list="#allLardonTableNames#"> 
    <cfquery name="get_ALL" DATASOURCE="Lardon2">       
     SELECT Doc_No, Remarks, Status, Describe
     FROM #Lardontable#
     WHERE Doc_No LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#form.txtBoxValue#%">
    </cfquery>
  
    <cfloop query="get_ALL"> <!--- loop through the results, adding the results to the results array ----->
       <cfset pos = arrayLen(ALL.data) + 1>
       <cfset ALL.data[pos] = structNew()>
       <cfset ALL.data[pos].doc_no = get_ALL.doc_no>    
       <cfset ALL.data[pos].Remarks =get_ALL.Remarks>    
       <cfset ALL.data[pos].Status = get_ALL.Status>    
       <cfset ALL.data[pos].Describe = get_ALL.Describe>    
       <cfset ALL.data[pos].tableName = Lardontable>
    </cfloop>
 </cfloop>
</CFIF>
 
 
 
 
<meta http-equiv="Contecnt-Type" content="text/html; charset=iso-8859-1">
<style type="text/css"> body {background-color=#A7EF9228bdee; }  .style2{color:#b51111} </style></body> 
 
<table>
 <tr> 
  <td>
  Number of files Generated:</br>
  <cfoutput><b>#arrayLen(All.data)#</cfoutput> 
  </td>
</tr>
</table>
<br> 
 
<cfset numberOfPages = ceiling(arrayLen(All.data) / pageSize)> <!--- numb records divided by page Size = how many pages, round up --->
<cfif pageNo gt numberOfPages> <!--- make sure page is not beyond the number of pages ---->
  <cfset
 pageNo = numberOfPages>
</cfif>
 
<!---- calculate the first record to show ---->
<cfset firstRecord = (pageNo - 1) * pageSize) + 1> 
<cfset lastRecord = min(firstRecord + pageSize - 1, arrayLen(All.data)> 
 
<!--- figure out the prev and next pages ---->
<cfset prevPage = max(1, pageNo - 1)>
<cfset nextPage = min(numberOfPages, pageNo + 1)>
 
<br><br>
 
<table width...> <tr> <th width.....><font...>Search Results:</font></th> <tr> 
<td>S/N</td> 
<td>DOC_NO></td> 
<td>DESCRIPTION</td> 
<td>STATUS</td>
<td>REMARKS</td> </tr> 
 
 
 
<cfloop index="pos" from="#firstRecord#" to="#lastRecord#">
<cfoutput>
<tr> 
 <td>#pos#</td>
 <td>#All.data[pos].Doc_No#</td>
 <td>#All.data[pos].Remarks#</td>
 <td>#All.data[pos].Status#</td>
 <td>#All.data[pos].Describe#</td>
</tr>
</cfoutput>
</cfloop>
</table>
 
<cfif #All.data.Doc_No# is 0>
<font size="4"> There is no records found!</font>
<cfabort>
</cfif><br>
 
</body></html>
 
<cfif val(prevPage)>
<a href="thisPageName.cfm?page=#prevPage#">Previous Page</a>
</cfif>
<cfif val(nextPage)>
<a href="thisPageName.cfm?page=#nextPage#">Next Page</a>
</cfif>

Open in new window

0
Comment
Question by:alexanderax
[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
  • 8
  • 4
12 Comments
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24418677
create a drop-down select and populate it with <option> tags with value = dsnname (one <option> tag for each dsn). then on your form;s action page use that select's value in the datasource attribute of your <cfquery> tag(s).

i.e. if your select list had name="datasources", then your query on the action page would have datasource="#form.datasources#"

for the 2 dsns listed in your code you would then have:

<select name="datasources" size="1">
<option value="DSN_dbl_IWS">DSN_dbl_IWS</option>
<option value="Lardon2">Lardon2</option>
</select>

you can even go further with that and give your table lists variables names to correspond to the dsn names, and then you will just need one loop instead of 2, e.g., based on your dsn names:

<cfset DSN_dbl_IWS_TableNames = "335K,335L,335M,335N, 310A,310B,310C,310D">
<cfset Lardon2_TableNames = "LAA, LCA, LCB, LCC, LCD, LCJ. LCT">

<cfloop index="tblName" list="#variables[form.datasources & '_TableNames']#">
    <cfquery name="get_ALL" DATASOURCE="DSN_dbl_IWS">      
     SELECT Doc_No, Remarks, Status, Describe
     FROM #tblName#
     WHERE Doc_No LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#form.txtBoxValue#%">
    </cfquery>
    ....
</cfloop>

Azadi
0
 

Author Comment

by:alexanderax
ID: 24418898
ok i will try it now. Can you look at my other questions? The error part when creating numbering pages..
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24419386
it looks like your other 2 open question are about the same error... and in one of them gdemaria already gave you an answer.

Azadi
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:alexanderax
ID: 24419451
gdemaria give the answer but i still got error...

Anyway i got error for the drop down list too..
Element #DSN_dbl_IWS# _TableNames is undefined in a java object of type class coldfusion.runtime.Variables referenced as

Can you edit from my code below?

As for the search page, you just can write the drop down list coding. Below is my form action page(Results page).
<cfparam name="url.pageno" default="1">
<cfparam name="url.pageSize" default="30">
<cfset pageSize = max(val(url.pageSize),10)> 
<cfset pageNo = max(val(url.pageNo),1)> 
<CFset index="1">
<cfparam name="form.txtBoxValue" default="">
 
 
<cfset variables.data = arrayNew(1)> 
 
<cfif isDefined("form.txtBoxValue") and len(form.txtBoxValue)>
 
  <cfset allTableNames = "335K,335L,335M,335N, 310A,310B,310C,310D">  
 
 
  <cfset allLardonTableNames = "LAA, LCA, LCB, LCC, LCD, LCJ. LCT">  
 
<!---IWS TABLE--->
  <cfloop index="IWSTable" list="#allTableNames#"> 
    <cfquery name="get_ALL" DATASOURCE="DSN_dbl_IWS">       
     SELECT Doc_No, Remarks, Status, Describe
     FROM #IWStable#
     WHERE Doc_No LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#form.txtBoxValue#%">
    </cfquery>
  
    <cfloop query="get_ALL"> <!--- loop through the results, adding the results to the results array ----->
       <cfset pos = arrayLen(ALL.data) + 1>
       <cfset ALL.data[pos] = structNew()>
       <cfset ALL.data[pos].doc_no = get_ALL.doc_no>    
       <cfset ALL.data[pos].Remarks =get_ALL.Remarks>    
       <cfset ALL.data[pos].Status = get_ALL.Status>    
       <cfset ALL.data[pos].Describe = get_ALL.Describe>    
       <cfset ALL.data[pos].tableName = IWStable>
    </cfloop>
 </cfloop>
 
 
<!---LARDON 2 TABLE--->
    <cfloop index="LardonTable" list="#allLardonTableNames#"> 
    <cfquery name="get_ALL" DATASOURCE="Lardon2">       
     SELECT Doc_No, Remarks, Status, Describe
     FROM #Lardontable#
     WHERE Doc_No LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#form.txtBoxValue#%">
    </cfquery>
  
    <cfloop query="get_ALL"> <!--- loop through the results, adding the results to the results array ----->
       <cfset pos = arrayLen(ALL.data) + 1>
       <cfset ALL.data[pos] = structNew()>
       <cfset ALL.data[pos].doc_no = get_ALL.doc_no>    
       <cfset ALL.data[pos].Remarks =get_ALL.Remarks>    
       <cfset ALL.data[pos].Status = get_ALL.Status>    
       <cfset ALL.data[pos].Describe = get_ALL.Describe>    
       <cfset ALL.data[pos].tableName = Lardontable>
    </cfloop>
 </cfloop>
</CFIF>
 
 
 
 
<meta http-equiv="Contecnt-Type" content="text/html; charset=iso-8859-1">
<style type="text/css"> body {background-color=#A7EF9228bdee; }  .style2{color:#b51111} </style></body> 
 
<table>
 <tr> 
  <td>
  Number of files Generated:</br>
  <cfoutput><b>#arrayLen(All.data)#</cfoutput> 
  </td>
</tr>
</table>
<br> 
 
<cfset numberOfPages = ceiling(arrayLen(All.data) / pageSize)> <!--- numb records divided by page Size = how many pages, round up --->
<cfif pageNo gt numberOfPages> <!--- make sure page is not beyond the number of pages ---->
  <cfset
 pageNo = numberOfPages>
</cfif>
 
<!---- calculate the first record to show ---->
<cfset firstRecord = (pageNo - 1) * pageSize) + 1> 
<cfset lastRecord = min(firstRecord + pageSize - 1, arrayLen(All.data)> 
 
<!--- figure out the prev and next pages ---->
<cfset prevPage = max(1, pageNo - 1)>
<cfset nextPage = min(numberOfPages, pageNo + 1)>
 
<br><br>
 
<table width...> <tr> <th width.....><font...>Search Results:</font></th> <tr> 
<td>S/N</td> 
<td>DOC_NO></td> 
<td>DESCRIPTION</td> 
<td>STATUS</td>
<td>REMARKS</td> </tr> 
 
 
 
<cfloop index="pos" from="#firstRecord#" to="#lastRecord#">
<cfoutput>
<tr> 
 <td>#pos#</td>
 <td>#All.data[pos].Doc_No#</td>
 <td>#All.data[pos].Remarks#</td>
 <td>#All.data[pos].Status#</td>
 <td>#All.data[pos].Describe#</td>
</tr>
</cfoutput>
</cfloop>
</table>
 
<cfif #All.data.Doc_No# is 0>
<font size="4"> There is no records found!</font>
<cfabort>
</cfif><br>
 
</body></html>
 
<cfif val(prevPage)>
<a href="thisPageName.cfm?page=#prevPage#">Previous Page</a>
</cfif>
<cfif val(nextPage)>
<a href="thisPageName.cfm?page=#nextPage#">Next Page</a>
</cfif>

Open in new window

0
 

Author Comment

by:alexanderax
ID: 24419524
Sorry as you see my desk do not have internet access and only i have to come to computer room then can be able to use internet access..

So for now is very difficult for me to get the search page unless i get printed it out and upload the picture..

Some more this web search engine is done on intranet.. Internet cannot get through it and my desk also cannot use floppy disk or thumbdrive.. I will try to find an thumbdrive by saving the coding for easy access to you. Down here i cannot bring in thumbdrive unless is authorized..
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24419979
goodness! what kind of development environment is that?! no internet access?! no unauthorized thumbdrives?! you must be working for some super-secret-super-spies....

anyway, i have already posted the code for your drop-down select before... and i have posted the code for you to use on your form's action page, too!

what else do you want me to do? i could probably come over there and type it for you on your desktop, but i guess i won't be allowed in without proper authorization and a full cavities search... :)

i will just point out one other thing about your code:
the way your prev/next pagination links are coded, you are going to lose any and all previously submitted form values. you need to pass those values (i.e. the selected datasource to search in and the value of form.txtBoxValue) along in those links, so that each page refresh can generate the same queires and same array or search results...

i may also add that the way you are going about it is extremely inefficient (generating same data on every next/previous link click). you may want to consider using some persistent scope variable to save the search results (your generated array) in to lessen the burden on your db and server... alternatively, and if javascript is 'authorized' by your some super-secret-super-spy organization, consider using something like jqGrid or TableSorter (both jQuery plug-ins) to display search results and pagination...

Azadi
0
 

Author Comment

by:alexanderax
ID: 24420183
Oh yes... I think that's the results why my page always get to the first of all pages whenever i click previous or next.. The code you gievn me also got an error..
0
 

Author Comment

by:alexanderax
ID: 24420198
And yes... i can use javascript.. How to do that saving data using javascript?
0
 

Author Comment

by:alexanderax
ID: 24435585
hi azadisaryev:

>you need to pass those values (i.e. the selected datasource to search in and the value of form.txtBoxValue) along in those links, so that each page refresh can generate the same queires and same array or search results...

Can you tell me how to passed those values(the selected datasource to search i and the value of form.txtBoxValue)
0
 
LVL 27

Accepted Solution

by:
azadisaryev earned 2000 total points
ID: 24437774
just add them to the query string in the links!

if, for example, the selected datasource is in #form.datasource# variable, then your links should look something like:

<cfif val(prevPage)>
<a href="thisPageName.cfm?page=#prevPage#&datasource=#urlencodedformat(form.datasource)#&txtBoxValue=#urlencodedformat(form.txtBoxValue)#">Previous Page</a>
</cfif>
<cfif val(nextPage)>
<a href="thisPageName.cfm?page=#nextPage#&datasource=#urlencodedformat(form.datasource)#&txtBoxValue=#urlencodedformat(form.txtBoxValue)#">Next Page</a>
</cfif>

then you will also need to add code to the top of your page that checks the URL scope for datasource and txtBoxValue variables. right now your code only checks the FORM scope for these - and when a user clicks next/prev link those FORM variables will NOT exist, but the URL variables will.
you can use structappend() function to append the URL structure to the FORM structure, so that any variables defined in URL scope are available in FORM scope as well (this way you will not need to change your code too much - your checks for form variables will still work!). this, added to the top of your page, should do the trick:

<cfset structAppend(form, url, false)>

Azadi
0
 

Author Comment

by:alexanderax
ID: 24437866
sorry i paste my coding here and can you show edit it from there? I used your drop down list but it says cannot find the table "310A".. Is like the code cannot query for the table.
<cfparam name="url.pageno" default="1">
<cfparam name="url.pageSize" default="30">
<cfset pageSize = max(val(url.pageSize),10)> 
<cfset pageNo = max(val(url.pageNo),1)> 
<CFset index="1">
<cfparam name="form.txtBoxValue" default="">
<cfset variables.data = arrayNew(1)> 
 
<cfif isDefined("form.txtBoxValue") and len(form.txtBoxValue)>
 
<cfset DSN_dbl_IWS_TableNames = "335K,335L,335M,335N, 310A,310B,310C,310D">  
<cfset Lardon2_TableNames = "LAA, LCA, LCB, LCC, LCD, LCJ. LCT">  
 
  <cfloop index="tblName" list="#variables[form.datasources & '_TableNames']#">
 
    <cfquery name="get_All" DATASOURCE="#form.tableNames#">       
     SELECT Doc_No, Remarks, Status, Describe
     FROM #tblName#
     WHERE Doc_No LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#form.txtBoxValue#%">
    </cfquery>
 
    <cfquery name="get_All" DATASOURCE="#form.tableNames#">       
     SELECT Doc_No, Remarks, Status, Describe
     FROM #tblName#
     WHERE Doc_No LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#form.txtBoxValue#%">
    </cfquery>
 
    <cfloop query="get_All"> <!--- loop through the results, adding the results to the results array ----->
       <cfset pos = arrayLen(Variables.data) + 1>
       <cfset Variables.data[pos] = structNew()>
       <cfset Variables.data[pos].doc_no = get_All.doc_no>    
       <cfset Variables.data[pos].Remarks =get_All.Remarks>    
       <cfset Variables.data[pos].Status = get_All.Status>    
       <cfset Variables.data[pos].Describe = get_All.Describe>    
       <cfset Variables.data[pos].tableName =tblName>
  </cfloop>
 </cfloop>
<cfset session.allData = variables.data>
<cfelseif isDefined("session.allData")>
<cfset variables.data = session.allData>
</CFIF>
 
<meta http-equiv="Contecnt-Type" content="text/html; charset=iso-8859-1">
<style type="text/css"> body {background-color=#A7EF9228bdee; }  .style2{color:#b51111} </style></body> 
 
<table>
 <tr> 
  <td>
  Number of files Generated:</br>
  <cfoutput><b>#arrayLen(Variables.data)#</cfoutput> 
  </td>
</tr>
</table>
<br> 
 
<cfset numberOfPages = ceiling(arrayLen(Variables.data) / pageSize)> <!--- numb records divided by page Size = how many pages, round up --->
<cfif pageNo gt numberOfPages> <!--- make sure page is not beyond the number of pages ---->
  <cfset
 pageNo = numberOfPages>
</cfif>
 
<!---- calculate the first record to show ---->
<cfset firstRecord = (pageNo - 1) * pageSize) + 1> 
<cfset lastRecord = min(firstRecord + pageSize - 1, arrayLen(Variables.data)> 
 
<!--- figure out the prev and next pages ---->
<cfset prevPage = max(1, pageNo - 1)>
<cfset nextPage = min(numberOfPages, pageNo + 1)>
 
<br><br>
 
<table width...> <tr> <th width.....><font...>Search Results:</font></th> <tr> 
<td>S/N</td> 
<td>DOC_NO></td> 
<td>DESCRIPTION</td> 
<td>STATUS</td>
<td>REMARKS</td> </tr> 
 
 
<cfoutput>
<cfloop index="pos" from="#firstRecord#" to="#lastRecord#">
<tr> 
 <td>#pos#</td>
 <td>#Variables.data[pos].Doc_No#</td>
 <td>#Variables.data[pos].Remarks#</td>
 <td>#Variables.data[pos].Status#</td>
 <td>#Variables.data[pos].Describe#</td>
</tr>
</cfloop>
</cfoutput>
</table>
 
<cfif arrayLen(Variables.data) eq 0>
<font size="4"> There is no records found!</font>
<input type="button" name="BackToMain" value="Back to Main Page" onClick="location.href='../drawing search/searchEngineMain.cfm'">
<br>
<cfelse>
<input type="button" name="BackToMain" value="Back to Main Page" onClick="location.href='../drawing search/searchEngineMain.cfm'">
<br>
<cfif val(prevPage)>
<a href="Search_resultsTesting.cfm?page=#prevPage#">Previous Page</a>
</cfif>
<cfif val(nextPage)>
<a href="tSearch_resultsTesting.cfm?page=#nextPage#">Next Page</a>
</cfif> 
 
<cfabort>
</cfif>
</body></html>

Open in new window

0
 

Author Comment

by:alexanderax
ID: 24439113
LATEST CODE


This is the latest version of my numbering codes. It can show 100 results for every pages. On the first page, it shows 1-100 but when i click on the second page, it shows 301-400 which is suppose to be the last page of the results. Same goes to the 3rd and 4th pages.

How to solve this problem? Show me exactly the code  if i'm missing something or do i need to create an application.cfm?

<cfset structAppend(form, url, false)>
<cfparam name="url.pageno" default="0">
<cfparam name="url.pageSize" default="100">
<cfset pageSize = max(val(url.pageSize),10)> 
<cfset pageNo = max(val(url.pageNo),1)> 
<CFset index="1">
<cfparam name="form.txtBoxValue" default="">
 
<cfset variables.data = arrayNew(1)> 
<cfif isDefined("form.txtBoxValue") and len(form.txtBoxValue)>
 
  <cfset DSN_dbl_IWS_TableNames = "335K,335L,335M,335N, 310A,310B,310C,310D">  
  <cfset Lardon2_TableNames = "LAA, LCA, LCB, LCC, LCD, LCJ. LCT">  
 
  <cfloop index="tblName" list="#variables[form.TableNames & '_TableNames']#"> 
    <cfquery name="get_All" DATASOURCE="DSN_dbl_IWS">       
     SELECT Doc_No, Remarks, Status, Describe
     FROM #tblName#
     WHERE Doc_No LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#form.txtBoxValue#%">
    </cfquery>
 
   <cfquery name="get_All" DATASOURCE="Lardon2">       
     SELECT Doc_No, Remarks, Status, Describe
     FROM #tblName#
     WHERE Doc_No LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#form.txtBoxValue#%">
    </cfquery>
 
    <cfloop query="get_All"> <!--- loop through the results, adding the results to the results array ----->
       <cfset pos = arrayLen(variables.data) + 1>
       <cfset variables.data[pos] = structNew()>
       <cfset variables.data[pos].doc_no = get_All.doc_no>    
       <cfset variables.data[pos].Remarks =get_All.Remarks>    
       <cfset variables.data[pos].Status = get_All.Status>    
       <cfset variables.data[pos].Describe = get_All.Describe>    
       <cfset variables.data[pos].tableName = tblName>
    </cfloop>
  </cfloop>
 
 <cfset session.allData = variables.data>
<cfelseif isDefined("session.allData")>
  <!--- this is not a search, so load the data back from the session variable --->
  <cfset variables.data = session.allData>
</CFIF>
 
<p align="center">
<cfset Result_Per_Page="100">
<cfset Total_Records="#arrayLen(Variables.data)#">
<cfparam name="url.pageno" default="0">
<cfset limit=URL.pageno + Result_Per_Page>
<cfset start_result=URL.pageNo + 1>
<cfoutput>Showing results #start_result#-
<cfif limit GT Total_Records>
#Total_Records#
<cfelse>
#limit#
</cfif>
	of #Total_Records#</cfoutput>
</p>
 
<p align="center">
<cfset URL.pageNo=URL.pageNo + 1>
 
<cfif Total_Results GT Result_Per_Page>
<cfif prevPage = URL.pageNo - Result_Per_Page - 1>
	<cfoutput>
	<a href="Search_Resultstesting.cfm?pageNo=#prevPage#&TableNames=#urlencodedformat(form.TableNames)#&txtBoxValue=#urlencodedformat(form.txtBoxValue)#">Previous</a>
	</cfoutput>
</cfif>
 
	<cfset Total_Pages=ceiling(Total_Records/Result_Per_Page)>
<cfloop index="i" from="1" to="#Total_pages#">
	<cfset j=i-1>
 
	<cfset pageNo_value=j*Result_Per_Page>
<cfif pageNo_value EQ URL.pageNo - 1>
	<cfoutput>#i#</cfoutput>
<cfelse>
 
<cfoutput>
<a href="search_Resultstesting.cfm?pageNo=#pageNo_value#&TableNames=#urlencodedformat(form.TableNames)#&txtBoxValue=#urlencodedformat(form.txtBoxValue)#">#i#</a>
</cfoutput>
</cfif>
</cfloop>
 
<cfif limit LT Total_Records>
<cfset nextPage = URL>pageNo + Result_Per_Page -1>
<cfoutput>
<a href="search_Resultstesting.cfm?pageNo=#nextPage#&TableNames=#urlencodedformat(form.TableNames)#&txtBoxValue=#urlencodedformat(form.txtBoxValue)#">Next
</a>
</cfoutput>
</cfif>
</cfif>
</p>
 
 
<meta http-equiv="Contecnt-Type" content="text/html; charset=iso-8859-1">
<style type="text/css"> body {background-color=#A7EF9228bdee; }  .style2{color:#b51111} </style></body> 
 
<table>
 <tr> 
  <td>
  Number of files Generated:</br>
  <cfoutput><b>#arrayLen(variables.data)#</cfoutput> 
  </td>
</tr>
</table>
<br> 
 
<cfset numberOfPages = ceiling(arrayLen(variables.data) / pageSize)> <!--- numb records divided by page Size = how many pages, round up --->
<cfif pageNo gt numberOfPages> <!--- make sure page is not beyond the number of pages ---->
  <cfset pageNo = numberOfPages>
</cfif>
 
<!---- calculate the first record to show ---->
<cfset firstRecord = (pageNo - 1) * pageSize) + 1> 
<cfset lastRecord = min(firstRecord + pageSize - 1, arrayLen(variables.data)> 
 
<!--- figure out the prev and next pages ---->
<cfset prevPage = max(1, pageNo - 1)>
<cfset nextPage = min(numberOfPages, pageNo + 1)>
 
<br><br>
 
<table width...> <tr> <th width.....><font...>Search Results:</font></th> <tr> 
<td>S/N</td> 
<td>DOC_NO></td> 
<td>DESCRIPTION</td> 
<td>STATUS</td>
<td>REMARKS</td> </tr> 
 
 
<cfoutput>
<cfloop index="pos" from="#firstRecord#" to="#lastRecord#">
<tr> 
 <td>#pos#</td>
 <td>#variables.data[pos].Doc_No#</td>
 <td>#variables.data[pos].Remarks#</td>
 <td>#variables.data[pos].Status#</td>
 <td>#variables.data[pos].Describe#</td>
</tr>
</cfloop>
</cfoutput>
</table>
 
<cfif arrayLen(variables.data) eq 0>
<font size="4"> There is no records found!</font>
<input type="button" name="BackToMain" value="Back to Main Page" onClick="location.href='../drawing search/searchEngineMain.cfm'">
<br>
<cfelse>
<input type="button" name="BackToMain" value="Back to Main Page" onClick="location.href='../drawing search/searchEngineMain.cfm'">
<br>
<cfif val(prevPage)>
<a href="search_Resultstesting.cfm?pageNo=#prevPage#&TableNames=#urlencodedformat(form.TableNames)#&txtBoxValue=#urlencodedformat(form.txtBoxValue)#">Previous Page</a>
</cfif>
<cfif val(nextPage)>
<a href="search_Resultstesting.cfm?pageNo=#nextPage#&TableNames=#urlencodedformat(form.TableNames)#&txtBoxValue=#urlencodedformat(form.txtBoxValue)#">Next Page</a>
</cfif> 
<cfexit>
</cfif>
</body></html>

Open in new window

0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
Suggested Courses

743 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