Skip navigation
Currently Being Moderated

Related selects and showing CFQUERY value

May 9, 2012 4:22 PM

I have a form that works well. Using a CFC, I have two CFSELECTS that are related. A selection on the first determines the display on the second. So far so good. But then I started thinking that users need to be reminded of what they are selecting. In the first CFSELECT the value is a user ID. I want to use that to populate a CFINPUT or simply a CFOUTPUT, but this has to be bound to the CFSELECT. So the user chooses her name. That populates a second CFSELECT with choices for her to select. But in between, I want to show her a choice she made months ago, and this is a value that I grabbed in the CFFUNCTION that is bound to that CFSELECT.

 

Is there a way to display another value after the CFSELECT? Another value that my CFQUERY in the CFC has already grabbed?

 

That would be really good. I could then, once a user has selected her name, show her user ID and other information and also show her this selection of some hardware that she made months ago and forgot about.

 

Then the form would go on to the second CFSELECT where she would select a date for tech service. But I think that part is unrelated to what I want to do in between.

 

I've Googled this scenario and the most likely solution is something like this.

 

Within a component and a CFFUNCTION, I would put something like this

 

<cfset var userModel=[queryname].userModel> (I'm just guessing here)

        <cfreturn userModel>

 

And then I'd be able to bind a CFINPUT to this component and function and display the userModel.

 

The user would see this and remember what hardware she chose and then go on to choose a date to get it.

 

I've tried variations on this but always get a message to the effect that the parameter has not been passed in.

 
Replies
  • Currently Being Moderated
    May 10, 2012 12:58 AM   in reply to waterunderthebridge

    If you showed us the cfc and the form, the explanation would be much easier to understand.

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 7:28 AM   in reply to BKBK

    Here's the CFC, followed by the form. The Name and Date CFSELECTS work. The model CFSELECT is the problem. I used the HTML view to paste the code.

    SELECT Name, Emp_Id, SelectionDate, ModelSelected FROM machine_Selection WHERE SelectionDate > '2012-05-31 00:00:00.000' ORDER BY Name         SELECT convert(varchar(6),lr.session_date,107) as session_date FROM Laptop_Rollout lr inner join laptop_selection ls on left(ls.modelselected, 2) = left(lr.session_name, 2) OR left(ls.modelselected, 2) = right(lr.session_name, 2) WHERE ls.emp_id = #arguments.emp_id# AND lr.session_date NOT IN ( select SelectionDate from laptop_selection where year(selectiondate) = 2012 group by SelectionDate having count(SelectionDate) >= 25 ) ORDER BY CONVERT(datetime, Session_Date, 103) ASC          <

    ************** the form *************************

    Select Name:Model Selected:  Rollout Date:    select date  

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 9:12 AM   in reply to sbudlong

    Please try again. The code you posted is mushed up.

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 9:42 AM   in reply to BKBK

    My related cfselects work fine. What I display in the first select is a list of user names, with their IDs as values, which is passed to the second select which will display a set of targeted dates. I also want the user to see a field of data from the cfquery in the cffunction that I bind to the first select. So when a user selects the name, the user will then see this data. I've tried using a cfinput, but the argument is not passed from the cfselect. cfquery that grabs Name, ID, ModelSelected

    cfquery that grabs dates from another table based on ModelSelected ***************  cfform *************************

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 9:48 AM   in reply to sbudlong

    Perhaps this will enable me to do what I want.

    From Adobe help with cfselect: "selected" = One or more option values to preselect in the selection list. To specify multiple values, use a comma-delimited list. This attribute applies only if selection list items are generated from a query. The cfform tag preserveData attribute can override this value.

    

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 9:53 AM   in reply to sbudlong

    No. Multiple values in a cfselect works only with a query, not a bind.

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 10:47 AM   in reply to sbudlong

    I got it. I just needed to reference the previous select, like this. bind="cfc:cfc.laptopModel.getModel({employee})"

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points