Post a query to the same page

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Post a query to the same page

    Hi All, I have a search page that has the ability to search for Lastname,
    firstname, typeOfAppointment. When I first load the page it displays the input
    fields just fine. But it also displays all of the records for each of the
    fields. How do I keep all of the records from displaying when the search page
    is loaded. I am attaching the code that I am using.

    <!-- Here is the code from the CFC -->
    <cfcomponent output="false">
    <cffunction name="getAll" access="public" returntype="query">
    <cfquery datasource="someActions" name="Everyone">
    SELECT emp.*, b.ParkName AS ParkName, pa.Description AS Description,
    pal.ID AS actionID
    FROM tbl_Some emp INNER JOIN
    tbl_Park_Action_Link pal ON emp.ID = pal.SomeID INNER
    JOIN
    tbl_Park b ON emp.ParkID = b.ID INNER JOIN
    tbl_Site_Action pa ON pal.SiteActionID = pa.ID
    WHERE FName LIKE '%#form.FName#%' and LName LIKE '%#form.LName#%'
    ORDER BY LName
    </cfquery>
    <cfreturn Everyone>
    </cffunction>
    </cfcomponent>


    <!-- This is the code from the search page -->
    <cfform action="" method="post">
    <cfinput type="text" name="FName">
    <cfinput type="text" name="LName">

    <cfinput type="submit" name="submit" value="Submit">
    </cfform>

    <cfparam name="form.Fname" default="">
    <cfparam name="form.LName" default="">

    <cfinvoke component="Search" method="getAll" returnvariable="Everyone">

    <cfoutput query="Everyone">
    <table border="0" cellpadding="3" cellspacing="0">
    <tr>
    <th>Name</th>
    <th>Position</th>
    </tr>
    <tr>
    <td>
    #LName#, #FName#
    </td>
    <td>
    #Description#
    </td>
    </tr>
    </table>

    </cfoutput>

    Thanks in advance.

    EdmondsM Guest

  2. Similar Questions and Discussions

    1. #25793 [Bgs]: special POST or GET query crashes PHP under Windows
      ID: 25793 Updated by: sniper@php.net Reported By: valyala at tut dot by Status: Bogus Bug Type: ...
    2. #25793 [Opn]: special POST or GET query crashes PHP under Windows
      ID: 25793 User updated by: valyala at tut dot by Reported By: valyala at tut dot by Status: Open Bug Type: ...
    3. #25793 [Com]: special POST or GET query crashes PHP under Windows
      ID: 25793 Comment by: Stephen at ediassociates dot com Reported By: valyala at tut dot by Status: Open Bug...
    4. Can a asp page post data to another asp page inside frameset?
      I know this is probably easy but here is the details. I have an asp page that is not inside a frameset. I want to post data to another asp page...
    5. Odd place to post Netscape query
      I know this may be an odd place to post a Netscape query but here goes anyway. Got a basic ASP.NET page that references JPGs from an 'images'...
  3. #2

    Default Re: Post a query to the same page

    I answered my own question. Just in case someone else is trying to do this
    same thing. Wrap the following code in <cfif isDefinded("form.submit")

    <cfform action="" method="post">
    <cfinput type="text" name="FName">
    <cfinput type="text" name="LName">

    <cfinput type="submit" name="submit" value="Submit">
    </cfform>

    <cfparam name="form.Fname" default="">
    <cfparam name="form.LName" default="">

    <cfinvoke component="Search" method="getAll" returnvariable="Everyone">

    <cfoutput query="Everyone">
    <table border="0" cellpadding="3" cellspacing="0">
    <tr>
    <th>Name</th>
    <th>Position</th>
    </tr>
    <tr>
    <td>
    #LName#, #FName#
    </td>
    <td>
    #Description#
    </td>
    </tr>
    </table>

    </cfoutput>

    EdmondsM Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139