Solved

ColdFusion How can I display the users search criteria after hitting the search button?

Posted on 2014-04-11
5
270 Views
Last Modified: 2014-04-12
I have a binded drop down - Select "Property" and "Projects" will list associated Projects with the Property.

The problem is above the query results displaying what the user queried - If the user clicks on a Property the Projects automatically display, and if the user does not click on a Project:
You searched for: Property = Georgetown Estates  Project/s = All

How can I display the Projects (associated with the Property) without the user clicking on them:
You searched for: Property = Georgetown Estates  Project/s = New Foundation, New Roof

Code displaying what the user queried:
You searched for: Property = #discipline1#  Project/s = #discipline2#

Binded drop down code:

<cfselect name="discipline4" style=width:150px;height:92px; title="Press and hold Ctrl key to select multiple projects" multiple>
    <option value="ALL">ALL</option>
    <cfoutput query="DropDown4">
      <option value="#DropDown4.projectnumber#">#DropDown4.projectnumber#</option>
    </cfoutput>
    <cfselect name="discipline4"
                bind="cfc:MyComponent.getProjects( {discipline1} )"
                value="projectnumber"
                display="projectnumber"/> 

Open in new window

0
Comment
Question by:DJPr0
[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
  • 3
  • 2
5 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 39995435
First, the code is a bit confusing since the field names don't match up with your descriptions. To avoid confusion, for now let's call them

<cfselect name="Property" multiple ....>
    <option value="ALL">ALL</option>
    <cfoutput query="DropDown4">
        <option .....</option>
    </cfoutput>
</cfselect>

<cfselect name="Project"
                bind="cfc:MyComponent.getProjects( {Property} )"
                value="projectnumber"
                display="projectnumber"/>


The problem is above the query results displaying what the user queried - If the user clicks on a Property the Projects automatically display, and if the user does not click on a Project:

You searched for: Property = Georgetown Estates Project/s = All

You're saying you already have code that displays the above? Can you post that code and any related cfc queries?
0
 

Author Comment

by:DJPr0
ID: 39995464
Basically I want to display what the Project Multi-select box displays in the query form when a Property is selected. (List Projects associated with Property selected)

Please note, I have a CFComponent which feeds the Project select box from the Property drop-down.

Code for: You searched for: Property = Georgetown Estates Project/s = All
             
 You searched for: Property = #discipline1#  Project/s = #discipline4#

Open in new window


Part of the query code:

<cfif discipline1 neq "ALL">
		AND Property = '#discipline1#' 
		</cfif>
<cfif discipline4 Is NOT "ALL">
	        AND projectnumber IN (#ListQualify(Form.discipline4,"'")#) 
			</cfif>

Open in new window

0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 39995495
You searched for: Property = #discipline1#  Project/s = #discipline4#

Ok so the reason it's displaying "All" is because that's the value of the FORM field.  

If you want it to display something different you either need to:

a)  Run the cfc query when the page loads

     <cfset obj = createObject("component", "MyComponent")>
     <cfset selectedProjects = obj.getProjects( FORM.ThePropertyField )>
     
Then use valueList to display the query results:
 
   ....
   You searched for: Property = #FORM.ThePropertyField#  
               Project/s = #ValueList(selectedProjects.projectnumber)#


OR

b) If you're automatically repopulating the "Project" list when the page loads, you could create another bind on that field. But that requires using a CFDIV or a CFINPUT, which might not fit with your layout.
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 500 total points
ID: 39995551
> Run the cfc query when the page loads

... or if the "Project" form field can sometimes contain a list of projects, only run the query if the form field value is "ALL".

(Edit)  I'm heading out. It's been a long week.  I'll check back tomorrow.
0
 

Author Closing Comment

by:DJPr0
ID: 39996688
Worked great, thanks _agx_!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

632 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