Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8629717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:52:36+00:00 2026-06-12T08:52:36+00:00

I have the below code on a ColdFusion page. This page displays the data

  • 0

I have the below code on a ColdFusion page. This page displays the data from the query below having 25 records per page with pagination. Now I need to provide a textbox and search button so that the user can enter the positionid and hit search….the problem I’m having here is how can the nth page be displayed if the positionid is in for example 7th page out of 200 pages. Please advice. Thanks

<cfquery name="qry_postn_detail" datasource="mbtran">
    select distinct position_id,schedule_group,accrual_profile,pay_rule_name,rest_days
    from kronos_if.position_detail  
    order by position_id 
</cfquery>

<cfset perpage = 25>

<cfparam name="url.start" default="1">
<cfif not isNumeric(url.start) or url.start lt 1 or url.start gt qry_postn_detail.recordCount or round(url.start) neq url.start>
    <cfset url.start = 1>
</cfif>

<cfset totalPages = ceiling(qry_postn_detail.recordCount / perpage)>
<cfset thisPage = ceiling(url.start / perpage)>

<cfset thisPage = Int(start / 25) + 1>

Page<cfoutput>
<cfloop from="1" to="#totalPages#" index="i">
    <cfif i is thisPage>
        #i#
    <cfelse>
        <cfif totalPages lte 5 or i is 1 or i is totalPages or (i gt thisPage - 3 and i lt thisPage + 3) or ((thisPage is 1 or thisPage is 2) and i lt 6) >
            <a href="?start=#(i*25)-24#">#i#</a>
        <cfelse>
            <cfif i is 2 or i is totalPages - 1>
                ...
            </cfif>
        </cfif>
     </cfif>
 </cfloop>
 </cfoutput>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:52:37+00:00Added an answer on June 12, 2026 at 8:52 am

    Based on your comment, I think all you need to do is include the search parameter in your query upon search form submission. Then the query result will only contain records matching what they searched for and your pagination code will still work as before but only for the matched records this time.

    So your query would look something like:

    <cfquery name="qry_postn_detail" datasource="mbtran">
        select distinct position_id,schedule_group,accrual_profile,pay_rule_name,rest_days
        from kronos_if.position_detail 
        <cfif IsDefined("form.searchfield") AND IsValid("integer", form.searchfield)>
            where position_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#form.searchfield#">
        </cfif>
        order by position_id 
    </cfquery>
    

    NOTE: I am assuming the position_id is an integer in your table. You will need to change the cfqueryparam type and validation logic appropriately based on it’s actual type.

    UPDATE from the new question posted in the comments below

    Here is a quick and simple example of how to use JavaScript to jump to a particular page. You mentioned that you already have a select box with the page numbers. All you need to do is add the onChange event handler to your select tag and call a JavaScript function that will reload the page with the selected value appended to the url.

    Your select will look something like this:

    <select name="page" onChange="jump(this.value);">
        <option value="101">101</option>
        <option value="102">102</option>
        <option value="103">103</option>
        <option value="104">104</option>
    </select>
    

    A simple JavaScript example looks like this:

    <script language="JavaScript">
        function jump(pagenum) {
            document.location.href("?start="+pagenum);
        }
    </script>
    

    Remember to validate/sanitize any and all values being passed to your ColdFusion pages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code below. delegate void TestDel(string str); static void Main(string[] args) {
I have below code: <a href=# id=@item.Id name=vote ><img src=/Content/images/021.png style=float:left alt= /></a> which
I have below code: class Program { static void Main(string[] args) { Task[] tasks
I have below code in html. <li class=selected runat=server id=lihome><a href=/ISS/home.aspx title=Home><span>Home</span></a></li> Now I
I have below code behind in c# if (Session[cmpDictionaryTitle]!= null) { downloadLinks.Text += @<li><a
I have below code to insert a style into DOM (there is a use
I have below code.The logic here is if HostList conatains any blanck entry it
I have below code which overrides equals() and hashcode() methods. public boolean equals(Object obj)
I have below code snippet SimpleDateFormat dateFormat = new SimpleDateFormat( yyyy-MM-dd hh:mm:ss.SSS); String processedContentDate=2012-04-10
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.