SELECT * FROM saa.vehicle_make
Vehicle Make:
SELECT * FROM saa.vehicle_make WHERE make = '#FORM.select_make#' <> 'null'
Vehicle Model:
DETAIL PAGE SELECT make, model, veh_year, ext_color, int_color, primary_image_path, mileage, price FROM saa.vehicle_ad WHERE saa.vehicle_ad.model = '#FORM.model#' ORDER BY price ASC Untitled Document
Picture
Year
Make
Model
Exterior Color
Interior Color
Mileage
Price
#searchResults2.primary_image_path#
#searchResults2.veh_year#
#searchResults2.make#
#searchResults2.model#
#searchResults2.ext_color#
#searchResults2.int_color#
#searchResults2.mileage#
#searchResults2.price#

First< /a> Previous Next Last
Records #StartRow_searchResults2# to #EndRow_searchResults2# of #searchResults2.RecordCount# [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Shane930 [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> Passing selection to detail page - Coldfusion - Advanced Techniques

Passing selection to detail page - Coldfusion - Advanced Techniques

Hi, I am still having a problem passing the a selection from my search page to the detail page. Here is the code for both. I am not sure where the problem resides and could use some solid input please. When the second list box is selected and I go to submit the page the detail page returns with no returns from the database. SEARCH PAGE: <cfparam name="FORM.select_make" default="1"> <html> <head> <title></title> </head> <body> <p align="center"><strong>Vehicle Search</strong></p> <!--- store the selected make variable after the first select boxes submits itself ---> <cfif isDefined('form.select_make')> <cfset page.select_make = form.select_make> </cfif> <cfoutput> <form ...

  1. #1

    Default Passing selection to detail page

    Hi, I am still having a problem passing the a selection from my search page to
    the detail page. Here is the code for both. I am not sure where the problem
    resides and could use some solid input please. When the second list box is
    selected and I go to submit the page the detail page returns with no returns
    from the database.

    SEARCH PAGE:

    <cfparam name="FORM.select_make" default="1">
    <html>
    <head>
    <title></title>

    </head>

    <body>
    <p align="center"><strong>Vehicle Search</strong></p>
    <!--- store the selected make variable after the first select boxes submits
    itself --->
    <cfif isDefined('form.select_make')>
    <cfset page.select_make = form.select_make>
    </cfif>
    <cfoutput>
    <form name="DropDown" method="post">
    <!--- query DB for the first drop down list --->
    <cfquery name="get_make" datasource="saa">
    SELECT * FROM saa.vehicle_make
    </cfquery>
    <!--- first drop down list --->
    <!--- NOTICE the onChange javascript event in the select tag, this is what
    submits the form after the first selection --->

    <table>
    <tr>
    <th align="center">Vehicle Make:</th>
    <td><select name="select_make" required="yes" onchange="this.form.submit()">
    <option>Select Make</option>
    <!--- dynamically populate the first drop down list based on the get_make
    query --->
    <cfloop query="get_make">
    <option value="#make#" <cfif isDefined('form.select_make')><cfif
    form.select_make eq "#make#">selected</cfif></cfif>>#make#</option>
    </cfloop>
    </select></td>
    </tr>
    </table>
    <!--- if the first selection has been made, display the second drop down list
    with the appropriate results --->
    <cfif isDefined('form.select_make')>
    <!--- query DB for second drop down list, based on the selected item from
    the first list --->
    <cfquery name="get_models" datasource="saa">
    SELECT * FROM saa.vehicle_make WHERE make = '#FORM.select_make#' <> 'null'
    </cfquery>
    <!--- second drop down list --->
    <table>
    <tr>
    <th align="center">Vehicle Model:</th>
    <td><select name="select_models" required="no">
    <option>Select Model</option>
    <!--- dynamically populate the second drop down list based on the
    get_make query --->
    <cfloop query="get_models">
    <option value="#model_1#">#model_1#</option>
    <option value="#model_2#">#model_2#</option>
    <option value="#model_3#">#model_3#</option>
    <option value="#model_4#">#model_4#</option>
    <option value="#model_5#">#model_5#</option>
    <option value="#model_6#">#model_6#</option>
    <option value="#model_7#">#model_7#</option>
    </cfloop>
    </select>
    </cfif>
    </form>
    </cfoutput>
    </td>
    </tr>

    </table>

    <form action="searchResultsTest2.cfm" method="post" name="Submit" id="Submit">
    <input type="submit" name="Submit" value="Submit">
    </form>


    </body>
    </html>

    DETAIL PAGE

    <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
    <cfparam name="FORM.model" default="100">
    <cfparam name="PageNum_searchResults2" default="1">
    <cfquery name="searchResults2" datasource="saa">
    SELECT make, model, veh_year, ext_color, int_color, primary_image_path,
    mileage, price FROM saa.vehicle_ad WHERE saa.vehicle_ad.model = '#FORM.model#'
    ORDER BY price ASC
    </cfquery>
    <cfset MaxRows_searchResults2=10>
    <cfset
    StartRow_searchResults2=Min((PageNum_searchResults 2-1)*MaxRows_searchResults2+1,
    Max(searchResults2.RecordCount,1))>
    <cfset
    EndRow_searchResults2=Min(StartRow_searchResults2+ MaxRows_searchResults2-1,searc
    hResults2.RecordCount)>
    <cfset
    TotalPages_searchResults2=Ceiling(searchResults2.R ecordCount/MaxRows_searchResul
    ts2)>
    <cfset QueryString_searchResults2=Iif(CGI.QUERY_STRING NEQ
    "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE("")) >
    <cfset
    tempPos=ListContainsNoCase(QueryString_searchResul ts2,"PageNum_searchResults2=",
    "&")>
    <cfif tempPos NEQ 0>
    <cfset
    QueryString_searchResults2=ListDeleteAt(QueryStrin g_searchResults2,tempPos,"&")>
    </cfif>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1" />
    <title>Untitled Doent</title>
    </head>

    <body>

    <table border="1" align="center">
    <tr>
    <td><div align="center">Picture</div></td>
    <td><div align="center">Year</div></td>
    <td><div align="center">Make</div></td>
    <td><div align="center">Model</div></td>
    <td><div align="center">Exterior Color</div></td>
    <td><div align="center">Interior Color</div></td>
    <td><div align="center">Mileage</div></td>
    <td><div align="center">Price</div></td>
    </tr>
    <cfoutput query="searchResults2" startRow="#StartRow_searchResults2#"
    maxRows="#MaxRows_searchResults2#">
    <tr>
    <td><div align="center">#searchResults2.primary_image_path#
    </a></div></td>
    <td><div align="center">#searchResults2.veh_year# </div></td>
    <td><div align="center">#searchResults2.make# </div></td>
    <td><div align="center">#searchResults2.model# </div></td>
    <td><div align="center">#searchResults2.ext_color# </div></td>
    <td><div align="center">#searchResults2.int_color# </div></td>
    <td><div align="center">#searchResults2.mileage# </div></td>
    <td><div align="center">#searchResults2.price# </div></td>
    </tr>
    </cfoutput>
    </table>
    <br>
    <table border="0" width="50%" align="center">
    <cfoutput>
    <tr>
    <td width="23%" align="center"><cfif PageNum_searchResults2 GT 1>
    <a
    href="#CurrentPage#?PageNum_searchResults2=1#Query String_searchResults2#">First<
    /a>
    </cfif>
    </td>
    <td width="31%" align="center"><cfif PageNum_searchResults2 GT 1>
    <a
    href="#CurrentPage#?PageNum_searchResults2=#Max(De crementValue(PageNum_searchRes
    ults2),1)##QueryString_searchResults2#">Previous</a>
    </cfif>
    </td>
    <td width="23%" align="center"><cfif PageNum_searchResults2 LT
    TotalPages_searchResults2>
    <a
    href="#CurrentPage#?PageNum_searchResults2=#Min(In crementValue(PageNum_searchRes
    ults2),TotalPages_searchResults2)##QueryString_sea rchResults2#">Next</a>
    </cfif>
    </td>
    <td width="23%" align="center"><cfif PageNum_searchResults2 LT
    TotalPages_searchResults2>
    <a
    href="#CurrentPage#?PageNum_searchResults2=#TotalP ages_searchResults2##QueryStri
    ng_searchResults2#">Last</a>
    </cfif>
    </td>
    </tr>
    </cfoutput>
    </table>
    <cfoutput>Records #StartRow_searchResults2# to #EndRow_searchResults2# of
    #searchResults2.RecordCount# </cfoutput>
    </body>
    </html>

    Shane930 Guest

  2. #2

    Default Re: Passing selection to detail page

    Turn on your de-bugging. Copy and paste the sql into something where you can
    query your database without using cold fusion. Do you get data?

    Originally posted by: Shane930
    Hi, I am still having a problem passing the a selection from my search page to
    the detail page. Here is the code for both. I am not sure where the problem
    resides and could use some solid input please. When the second list box is
    selected and I go to submit the page the detail page returns with no returns
    from the database.


    Dan Guest

  3. #3

    Default Re: Passing selection to detail page

    Hi Dan, when I test the SQL from debugging in SQLyog: SELECT make, model,
    veh_year, ext_color, int_color, primary_image_path, mileage, price FROM
    saa.vehicle_ad WHERE model = '1' ORDER BY price ASC, I get no return from the
    DB. So the search page is not passing the selection to the detail page and the
    query is defaulting to '1'. When I change the '1' to a model I get an
    immediate return as expected.

    Shane

    Shane930 Guest

  4. #4

    Default Re: Passing selection to detail page

    It appears to me the value in want to reference in the model query is 'Form.select_models'.

    (<th align="center">Vehicle Model:</th>
    <td><select name="select_models" required="no">
    )

    Pam
    AAOS Guest

Similar Threads

  1. Preserve cfselect value from detail page to edit page
    By Manuel in forum Coldfusion - Getting Started
    Replies: 4
    Last Post: June 11th, 10:48 PM
  2. Passing selection to Master Detail Page
    By Shane930 in forum Coldfusion - Advanced Techniques
    Replies: 3
    Last Post: November 2nd, 10:36 PM
  3. Go to next from detail page
    By ukjooles in forum Dreamweaver AppDev
    Replies: 1
    Last Post: April 13th, 10:20 AM
  4. Can I open a page as a popup using GOTO DETAIL PAGE
    By Don Pacino in forum Dreamweaver AppDev
    Replies: 0
    Last Post: April 9th, 09:42 PM
  5. Go to Detail page
    By Pete Casey in forum ASP Database
    Replies: 0
    Last Post: April 28th, 11:46 AM

Bookmarks

Posting Permissions

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