Solved

CFGRID selectmode

Posted on 2001-08-28
2
515 Views
Last Modified: 2013-12-24
My form page has the following code.  On my action page I want to refer to the value of PersonID of the selected row.  I haven't been able to get this to work, even though it's probably pretty simple.  What is the exact variable name that I should use on the action page? (eg, form.MailingGrid.PersonID or what?)  Thx.



<cfform action="mailing_action.cfm" method="POST" name="loginform">

<cfgrid name="MailingGrid" height="290" width="760" query="GetListValues" selectmode="ROW" sort="yes" rowheaders="no" bgcolor="##ffffff" selectcolor="##cccccc">

<cfgridcolumn name="PersonID" select="no" display="no">
<cfgridcolumn name="NameFirst" header="First Name" select="no" width="90">
<cfgridcolumn name="NameLast" header="Last Name" select="no" width="90">

</cfgrid>
</cfform>

0
Comment
Question by:brettstil
  • 2
2 Comments
 
LVL 1

Expert Comment

by:FranzRinkleff
Comment Utility
<cfset datasource="abc">
<html>
<head>
     <title>CFGRID</title>
</head>
<body>
     <cfif IsDefined("submitButton")>
          <cfoutput>
               #employeeGrid.full_name#
               <br>
               #employeeGrid.employee_number#
          </cfoutput>
     <cfelse>
          <cfquery name="employees" datasource="#datasource#">
               select full_name, employee_number from xyz.whiteGreen
               where current_employee = 'Y'
               order by full_name;
          </cfquery>
          <cfform name="employeeForm" action="empInfo.cfm" method="post">
               <CFGRID NAME="employeeGrid" query="employees" selectmode="ROW">
                    <cfgridcolumn name="full_name" header="Full Name">
                    <cfgridcolumn name="Employee_Number" header="Employee Number">
               </cfgrid>    
               <input type="submit" name="submitButton" value="submit">
          </cfform>
     </cfif>
</body>
</html>
0
 
LVL 1

Accepted Solution

by:
FranzRinkleff earned 50 total points
Comment Utility
you will not be able to cut and past the code above to test it since you don't have access to my database

but this does what you want.  i think.

the big answer to your question is you put the gridname followed by the dot followed by the columnname enclosed by pound signs

so in your case on the page that is called by the form you would use the following code to display the selected information on the screen

<cfoutput>
  #MailingGrid.PersonID#
  #MailingGrid.NameFirst#
  #MailingGrid.NameLast
</cfoutput>

in my example the form calls the same page.  it checks to see if the submitbutton is defined if it is it displays the selected information.  if not it displays the form.  

if you have any questions let me know.  
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now