Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-04-11
5
Medium Priority
?
283 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 2000 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 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