Skip to main content
Known Participant
October 30, 2012
Question

Passing associated values with selected item in CFFORM?

  • October 30, 2012
  • 1 reply
  • 743 views

I query a database for names and different grades for subjects.  For example, I requested for "Mary" and the database returns more than one "Mary".  So I displayed the different "Mary" with a cfform and list all the "Mary" with a radio button and let user choose the right "Mary".

e.g.

cfquery...

if more than one student with same name then

<cfform action="nextprogram">

<cfoutput query=list>

<cfinput type=radio name=studentname value=#studentname#>#studentname#, #studentlastname#

<cfinput type=hidden name=math value=#math#>

<cfinput type=hidden name=physic value=#physic#>

....

</cfoutput>

</cfform>

Of course, I realize this will not work because if there are 10 "Mary" and I select the first "Mary", the application will not know which math, physic grades etc. belong to the first "Mary". Since I have already done the database query with all the information retrieved, I don't want to do a database query again.  How do I pass the all the information belong to the chosen "Mary" to the "nextprogram"?   This is probably very easy to do with different CF tag, but I haven't used Coldfusion for a while, so any help is appreciated.  Thank you.

Jack

    This topic has been closed for replies.

    1 reply

    Inspiring
    October 30, 2012

    Instead of value = studentname, use value = studentid

    jackhuangAuthor
    Known Participant
    October 30, 2012

    Hi Dan,

    Even if I pass studentid that still won't work. I still need to somehow pass all the grades associated with the selected studentid to the secondprogram. 

    Jack

    Inspiring
    October 30, 2012

    You could always pass a list and process it on the next page.  Something like

    name=Mary Smith,physics=85,math=50