Mar
09

Filtering records on a cfform grid

49 comments Posted by: Nahuel Foronda

After reading what Simeon from Simfluence wrote today, I started playing with his example and I modified a little bit his code. Some of the changes I made are that I keep the data in the global scope instead of the shared object and maintain the row numbers on the grid.
Here is the result.
And the code:
<cfscript>
   rs = queryNew("id,fname,lname,dept,email");
   addRow(rs, 'simeon','bateman','IT','simeon@eee.net');
   addRow(rs, 'Mr','Man','HR','theMan@eee.com');
   addRow(rs, 'Cool','Guy','HR','coolGuy@eee.com');
   addRow(rs, 'Another','test','Customer Service','another@teeeest.com');
   function addRow( qry, fname, lname, dept, email){
      queryAddRow(rs);
      querySetCell(rs,'fname',fname);
      querySetCell(rs,'lname',lname);
      querySetCell(rs,'dept',dept);
      querySetCell(rs,'email',email);
   }
</cfscript>

<cfquery dbtype="query" name="getDepts">
   SELECT distinct dept
   FROM rs
   ORDER BY dept
</cfquery>
<cfquery dbtype="query" name="MemberList">
   SELECT * from rs
   ORDER BY dept
</cfquery>

<cfsavecontent variable="astest">
   if(_global.arrMembers == undefined) _global.arrMembers = data.dataProvider.slice(0);

   var arrMembers = _global.arrMembers;
   var arrDisplay:Array = [];

   for(var i = 0; i < arrMembers.length; i++)
   {
      if(arrMembers[i].dept == myselect1.value || myselect1.value == 'All')
      {
         arrDisplay.push(arrMembers[i]);
      }
   }
   data.dataProvider = arrDisplay;
</cfsavecontent>

<cfform name="myForm" format="flash" width="400" height="300">
   <cfformgroup type="panel" label="Search our Members">
      <cfselect query="getDepts" queryposition="below" label="Parent category" name="myselect1" value="dept" display="dept" width="200" onChange="#astest#">
         <option value="All">All</option>
      </cfselect>
      <cfgrid name="data" query="MemberList" >
         <cfgridcolumn header="First Name" name="fname" />
         <cfgridcolumn header="Last Name" name="lname" />
         <cfgridcolumn header="email" name="email" />
         <cfgridcolumn header="Department" name="dept" display="false" />
      </cfgrid>
   </cfformgroup>
</cfform>

View the example.
Download the source.

Category: CFForm | ColdFusion |

49 Comments so far

Write yours
Dean Glasener
1. Dean Glasener wrote on March 10, 2005 at 7:10 AM
Thanks for your excellent solution to extend form and grid functionality. Could a chart be added below the grid to dynamically graph sales by department by year-month?

1) cfset a variable to - - - department selected
2) can we do any code in the cfsavecontent.. a new cfquery to collect the data for the department selected.

TIA for your help.
2. Shawn wrote on March 10, 2005 at 1:46 PM
Great workaround here.

I was also wondering about a way to edit, add, delete rows from the grid. I think that filling text inputs would be the best way to do it. I tried to do it with an editable grid, but encountered some problems. If you do the filter, then edit (or delete) a record, and click submit, the information is not passed through.

Still working on it though. Might have to give up and just populate text boxes.

Thanks again.
Nahuel
Hi Dean,
Adding the charts would be possible but it's not an easy task. The problem is that you can not add a chart to a cfform (Macromedia didn't implement that feature). The only way would be saving the charts as jpg and then loading them from the form. In that case, however, the chart won't be dynamic and will have to be created before showing the form.
Nahuel
Hi Shawn,
I wonder what data is received when you submit the form. What may be happening is that you only receive the filtered data (what you are seeing in the grid) but not all the records. You could make a custom submit button to inject all the data in the grid and them submit it.
Matt Langston
5. Matt Langston wrote on March 10, 2005 at 8:48 PM
Great post showing how to use AS with cfgrid. I've been trying to figure out how to programatically select a row in a cfgrid so that it is highlighted after a form postback. For example, if the user selects a row in a cfgrid and posts the form with the cfgrid back to the server, how would one repopulate the cfgrid and select the row clicked by the user?
Nahuel
Hi Matt,
You can check my next post about how to make an onLoad event. But the data that is loaded in the datagrid comes via Remoting and takes a few seconds to load. So you may need to do some kind of delay if you want to select a row. Otherwise, when the data comes it overwrite your selection. What you are trying to achieve is not easy but is possible.
Mathijs
This blog has provided a lot of help with cfmx 7 for me... Would it be possible to make a filter on the grid with multiple selectboxes?
Mathijs
:-) i just found out myself... actually with no AS experience:
just do something like this:
&lt;cfsavecontent variable=&quot;sortbypage&quot;&gt;
if(_global.arrMembers == undefined) _global.arrMembers = data.dataProvider.slice(0);

var arrMembers = _global.arrMembers;
var arrDisplay:Array = [];

for(var i = 0; i &lt; arrMembers.length; i++)
{
if(arrMembers[i].ContentPath == myselect1.value || myselect1.value == 'All')
{
      if(arrMembers[i].ContentLanguage == myselect2.value || myselect2.value == 'All')
      {
arrDisplay.push(arrMembers[i]);
       }
}
}
data.dataProvider = arrDisplay;
&lt;/cfsavecontent&gt;

&lt;cfsavecontent variable=&quot;sortbylanguage&quot;&gt;
if(_global.arrMembers == undefined) _global.arrMembers = data.dataProvider.slice(0);

var arrMembers = _global.arrMembers;
var arrDisplay:Array = [];

for(var i = 0; i &lt; arrMembers.length; i++)
{
if(arrMembers[i].ContentLanguage == myselect2.value || myselect2.value == 'All')
{
      if(arrMembers[i].ContentPath == myselect1.value || myselect1.value == 'All')
      {
arrDisplay.push(arrMembers[i]);
       }
}
}
data.dataProvider = arrDisplay;
&lt;/cfsavecontent&gt;
Steve Moore
I am having no luck implementing this in a real world application with data from a database. What does data.dataProvider.slice(0) do? I've put in an alert to display each value in the array, but they're all blank, so not equal to the selected value. Doesn't look like my array is getting populated from the query.

for(var i = 0; i &lt; arrMembers.length; i++)
{
alert(arrMembers[i].department,'Routine',mx.controls.Alert.OK);
if(arrMembers[i].department == myselect1.value || myselect1.value == 'All')
{
arrDisplay.push(arrMembers[i]);
}
}
Steve Moore
Solution to previous post found. Fieldnames are apparently case sensitive in ActionScript. CF query is:

&lt;cfquery name=&quot;getPositions&quot; datasource=&quot;erpd&quot;&gt;
select department, job_title
from xxhr_job_postings_v
order by department, job_title
&lt;/cfquery&gt;

But fieldnames returned are in uppercase. Therefore ActionScript code must be:

if(arrMembers[i].DEPARTMENT == myselect1.value || myselect1.value == 'All')
brent
11. brent wrote on May 20, 2005 at 12:46 PM
Ids there away to pre-sort the that is initially loaded into the data grid.
Laura
Brent,
You can sort the data in your query and that is the sorting it will get when the grid is loaded.
Sergey
13. Sergey wrote on June 08, 2005 at 1:45 PM
Shawn,

I have the same problem. Information is not passed to the action page after you do grid filtering.

Have you solve this problem?. Does anybody have solution?
Thanks.
Nahuel
Shawn,
I know what the problem is. We would need to change the code to address that. I will made a new post in the future that may help you.
Syed
15. Syed wrote on June 12, 2005 at 7:45 PM
I was tring this script but had no luck. I copy pasted and only the grid shows but no data. Am I missing something? And I have tried bunch of Grid script but they all are not working. Can please someone help!
DavidR
16. DavidR wrote on June 30, 2005 at 5:05 PM
Any suggestions on how to pre-select a &quot;category&quot;? In other words, when the form is loaded, instead of all records being shown by default, only HR records would be shown.

Thanks.
Paul
17. Paul wrote on July 03, 2005 at 8:24 AM
Just wondering if the ISSUE noted by shawn, about the grid NOT posting data back has been solved and posted.
I cannot see the Datagrid on POST, so my idea to enumerate by hand failed!
      &lt;cfif IsDefined('form.data.rowstatus.action')&gt;
         &lt;cfloop index=&quot;i&quot; from=&quot;1&quot; to=&quot;#ArrayLen(form.data.rowstatus.action)#&quot;&gt;
         &lt;!--- insert statement---&gt;
         &lt;cfif form.data.rowstatus.action[i] IS &quot;I&quot;&gt;
      Do an Insert blah blah
            
            &lt;!--- delete statement---&gt;
         &lt;cfelseif form.data.rowstatus.action[i] IS &quot;D&quot;&gt;
      Do an Delete
         &lt;/cfif&gt;
         &lt;/cfloop&gt;
      &lt;/cfif&gt;
Michael White
Perhaps with a slight modification this technique could be used to filter one grid with the selected item of another, like if you had a grid with orders, selected one and the grid with a list of items showed up in another grid below it?
Casey A
19. Casey A wrote on August 26, 2005 at 7:09 AM
Hi all...Regardless of the CFGrid/CFForm that I use, I continue to receive the following error!

Line: 1
Char: 1
Error: Object Expected
Code: 0

Here's the code for this example:
&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;var lc_id = Math.floor(Math.random() * 100000).toString(16);&lt;/script&gt;


&lt;cfquery name=&quot;updates&quot; datasource=&quot;#application.dsn.oiws#&quot;&gt;
SELECT *
FROM tbl_List360
ORDER BY lastName
&lt;/cfquery&gt;

&lt;cfform name=&quot;myForm&quot; format=&quot;flash&quot; width=&quot;450&quot; height=&quot;350&quot; action=&quot;handle_grid.cfm&quot;&gt;
&lt;cfgrid name= &quot;myGrid&quot; query=&quot;updates&quot; height=&quot;150&quot; rowheaders=&quot;yes&quot; insert=&quot;yes&quot; InsertButton=&quot;Insert New Record&quot; selectmode=&quot;edit&quot;&gt;
&lt;cfgridcolumn name=&quot;racf&quot; header=&quot;RACF ID&quot; select=&quot;true&quot;&gt;
&lt;cfgridcolumn name=&quot;lastName&quot; header=&quot;Last Name&quot; select=&quot;true&quot;&gt;
&lt;cfgridcolumn name=&quot;firstName&quot; header=&quot;First Name&quot; select=&quot;true&quot;&gt;
&lt;cfgridcolumn name=&quot;active&quot; header=&quot;Active 0 or 1&quot; select=&quot;true&quot; dataalign=&quot;center&quot;&gt;
&lt;/cfgrid&gt;
&lt;cfinput type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Update Records&quot; action=&quot;handle_grid.cfm&quot;&gt;
&lt;/cfform&gt;


Here's the handle_grid:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Catch submitted grid values&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;h3&gt;Grid values for Form.myGrid row updates&lt;/h3&gt;

&lt;cfif isdefined(&quot;Form.myGrid.rowstatus.action&quot;)&gt;

&lt;cfloop index = &quot;Counter&quot; from = &quot;1&quot; to =
#arraylen(Form.myGrid.rowstatus.action)#&gt;

&lt;cfoutput&gt;
The row action for #Counter# is:
#Form.myGrid.rowstatus.action[Counter]#
&lt;br&gt;
&lt;/cfoutput&gt;

&lt;cfif Form.myGrid.rowstatus.action[counter] is &quot;D&quot;&gt;

&lt;cfquery name=&quot;DeleteExistingEmployee&quot;
datasource=&quot;#application.dsn.oiws#&quot;&gt;
DELETE FROM tbl_List360
WHERE
   racf='#Form.myGrid.original.racf[Counter]#'
&lt;/cfquery&gt;

&lt;cfelseif Form.myGrid.rowstatus.action[counter] is &quot;U&quot;&gt;

&lt;cfquery name=&quot;UpdateExistingEmployee&quot;
datasource=&quot;#application.dsn.oiws#&quot;&gt;
UPDATE tbl_List360
SET
racf='#Form.myGrid.racf[Counter]#',
lastName='#Form.myGrid.lastName[Counter]#',
firstName='#Form.myGrid.firstName[Counter]#',
active='#Form.myGrid.active[Counter]#'
WHERE
racf='#Form.myGrid.original.racf[Counter]#'
&lt;/cfquery&gt;

&lt;cfelseif Form.myGrid.rowstatus.action[counter] is &quot;I&quot;&gt;

&lt;cfquery name=&quot;InsertNewEmployee&quot;
datasource=&quot;#application.dsn.oiws#&quot;&gt;
INSERT into tbl_List360
(racf, lastName, firstName, active)
VALUES ('#Form.myGrid.racf[Counter]#', '#Form.myGrid.lastName[Counter]#', '#Form.myGrid.firstName[Counter]#', #Form.myGrid.active[Counter]#)
&lt;/cfquery&gt;

&lt;/cfif&gt;
&lt;/cfloop&gt;
&lt;/cfif&gt;

&lt;/body&gt;
&lt;/html&gt;
Laura
Casey,
Where do you get that error?
Casey A
21. Casey A wrote on August 30, 2005 at 2:12 PM
Hey Laura,

Sorry for the delayed response. Everything is working fine now, to resolve this issue I refreshed a few of the files in the CFIDE directory in our 'live' environment and it worked just fine! Go figure.
Michael White
I found an entry on the Macromedia coldfusion forums from June that shows how to filter one grid with another. the poster had trouble pasting the code so it came in three parts. I have it all together for anyone that needs it. I'm not crazy about naming your grids &quot;data&quot; and &quot;data1&quot; because it confuses beginners, but here it is:

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Two DataGrids&lt;/title&gt;
&lt;/head&gt;
&lt;cfset myQuery1 = querynew(&quot;departmentid, departmentname&quot;)&gt;

&lt;cfset myQuery2 = querynew(&quot;departid, name&quot;)&gt;

&lt;!--- make some rows in the query ---&gt;
&lt;cfset newRow1 = QueryAddRow(MyQuery1, 2)&gt;
&lt;cfset newRow2 = QueryAddRow(MyQuery2, 4)&gt;

&lt;!--- set the cells in the query ---&gt;

&lt;cfset temp1 = QuerySetCell(myQuery1, &quot;departmentid&quot;, &quot;1&quot;, 1)&gt;
&lt;cfset temp1 = QuerySetCell(myQuery1, &quot;departmentname&quot;, &quot;Department 1&quot;, 1)&gt;

&lt;cfset temp1 = QuerySetCell(myQuery1, &quot;departmentid&quot;, &quot;2&quot;, 2)&gt;
&lt;cfset temp1 = QuerySetCell(myQuery1, &quot;departmentname&quot;, &quot;Department 2&quot;, 2)&gt;


&lt;cfset temp2 = QuerySetCell(myQuery2, &quot;departid&quot;, &quot;1&quot;, 1)&gt;
&lt;cfset temp2 = QuerySetCell(myQuery2, &quot;name&quot;, &quot;Fred&quot;, 1)&gt;

&lt;cfset temp2 = QuerySetCell(myQuery2, &quot;departid&quot;, &quot;1&quot;, 2)&gt;
&lt;cfset temp2 = QuerySetCell(myQuery2, &quot;name&quot;, &quot;Jane&quot;, 2)&gt;

&lt;cfset temp2 = QuerySetCell(myQuery2, &quot;departid&quot;, &quot;2&quot;, 3)&gt;
&lt;cfset temp2 = QuerySetCell(myQuery2, &quot;name&quot;, &quot;John&quot;, 3)&gt;

&lt;cfset temp2 = QuerySetCell(myQuery2, &quot;departid&quot;, &quot;2&quot;, 4)&gt;
&lt;cfset temp2 = QuerySetCell(myQuery2, &quot;name&quot;, &quot;Jane&quot;, 4)&gt;


&lt;cfsavecontent variable=&quot;actionFilter&quot;&gt;
if(_global.arrMembers == undefined) _global.arrMembers = data1.dataProvider.slice(0);
var arrMembers = _global.arrMembers;
var arrDisplay:Array = [];
var selected = data.selectedItem.departmentid;

for(var i = 0; i &lt; arrMembers.length; i++)
{
if(arrMembers[ i ][&quot;departid&quot;] == selected)
{
arrDisplay.push(arrMembers[ i ]);
}
}
data1.dataProvider = arrDisplay;
&lt;/cfsavecontent&gt;


&lt;body&gt;
&lt;cfform
   action=&quot;&quot;
   method=&quot;POST&quot;
   name=&quot;myForm&quot;
   format=&quot;Flash&quot;
   timeout=&quot;300&quot;
   preservedata=&quot;Yes&quot;&gt;
      &lt;cfformgroup type=&quot;HORIZONTAL&quot;&gt;
         &lt;cfgrid name=&quot;data&quot;
            width=&quot;300&quot;
            format=&quot;FLASH&quot;
            query=&quot;myQuery1&quot;
            insert=&quot;No&quot;
            delete=&quot;No&quot;
            sort=&quot;Yes&quot;
            bold=&quot;No&quot;
            italic=&quot;No&quot;
            autowidth=&quot;true&quot;
            appendkey=&quot;No&quot;
            highlighthref=&quot;No&quot;
            enabled=&quot;Yes&quot;
            visible=&quot;Yes&quot;
            griddataalign=&quot;LEFT&quot;
            gridlines=&quot;Yes&quot;
            rowheaders=&quot;Yes&quot;
            rowheaderalign=&quot;LEFT&quot;
            rowheaderitalic=&quot;No&quot;
            rowheaderbold=&quot;No&quot;
            colheaders=&quot;Yes&quot;
            colheaderalign=&quot;LEFT&quot;
            colheaderitalic=&quot;No&quot;
            colheaderbold=&quot;No&quot;
            selectmode=&quot;BROWSE&quot;
            picturebar=&quot;No&quot;
            onchange=&quot;#actionFilter#&quot;&gt;
         &lt;cfgridcolumn name=&quot;departmentid&quot;&gt;
         &lt;cfgridcolumn name=&quot;departmentname&quot;&gt;
      &lt;/cfgrid&gt;
   
      &lt;cfgrid name=&quot;data1&quot;
         width=&quot;200&quot;
         format=&quot;FLASH&quot;
         query=&quot;myQuery2&quot;
         insert=&quot;No&quot;
         delete=&quot;No&quot;
         sort=&quot;Yes&quot;
         bold=&quot;No&quot;
         italic=&quot;No&quot;
         autowidth=&quot;true&quot;
         appendkey=&quot;No&quot;
         highlighthref=&quot;No&quot;
         enabled=&quot;Yes&quot;
         visible=&quot;Yes&quot;
         griddataalign=&quot;LEFT&quot;
         gridlines=&quot;Yes&quot;
         rowheaders=&quot;Yes&quot;
         rowheaderalign=&quot;LEFT&quot;
         rowheaderitalic=&quot;No&quot;
         rowheaderbold=&quot;No&quot;
         colheaders=&quot;Yes&quot;
         colheaderalign=&quot;LEFT&quot;
         colheaderitalic=&quot;No&quot;
         colheaderbold=&quot;No&quot;
         selectmode=&quot;BROWSE&quot;
         picturebar=&quot;No&quot;&gt;
      &lt;cfgridcolumn name=&quot;departid&quot;&gt;
      &lt;cfgridcolumn name=&quot;name&quot;&gt;
   &lt;/cfgrid&gt;
&lt;/cfformgroup&gt;
&lt;/cfform&gt;


&lt;/body&gt;
&lt;/html&gt;
Brandon
23. Brandon wrote on September 19, 2005 at 10:15 AM
I have downloaded the source, and attempted to run it to no avail, i get a populated grid but onchange i have no response to the grid contents...is there some way i can bug test or somthing I'm missing?
Brandon
24. Brandon wrote on September 19, 2005 at 11:01 AM
it seems i'm having a problem with ALL actionscripting when going through my OO framework. Unfortunately i cannot track down where the problem starts. All my code executes through a tag called OO.cfm. It in turn creates objects etc etc....it calls object methods through cfmodule. i can cfmodule this code by itself, and it works, but for some reason it doesnt work through my oo.cfm. are there any protected variable names that cant exist while running cfforms that might be getting in the way of my actionscript from working?
Brandon
25. Brandon wrote on September 19, 2005 at 11:12 AM
Okiedokie....found out somthin i didnt know. if &lt;cfsetting enablecfoutputonly=&quot;Yes&quot;&gt; then the content inside a cfsavecontent gets ignored!...

my oo.cfm has that turned on during execution to ensure clean output. and since the code within had no &lt;cfoutout&gt; around it the cfsavecontent was ...empty. Once i surrounded the cfsavecontent tags with a cfoutput all was well....somthing for the records!
Mitch
26. Mitch wrote on October 19, 2005 at 2:18 PM
Anyone yet find a solution to the problem Shawn posted a while ago about the grid data not coming to the action page after the filter processes?
28. James wrote on December 01, 2005 at 8:09 AM
Is there a way to compare two dates using an expression in the cfgridcolumn textColor property?

Eg. If date1 is greater then date2 show red otherwise black.
Laura
James,
You will have to write some actionScript for that in a separate function that checks whatever you want. It might be slow though if you have many records. Check this post:
http://www.asfusion.com/blog/entry/looping-over-the-records-of-a-large-cfgrid

And by the way, if you have a question, please post it *once* in a post related to the question and we will try to answer as quickly as possible. Thanks
30. James wrote on December 03, 2005 at 6:59 PM
Thanks for the response Laura.

I am new to actionscripting but I tried using the expression:

textColor=&quot;(date1 LT date2 ? red : black)&quot; without success. Any ideas?

Thanks
CFSolar
on 6/12/05, Syed wrote: &quot;I copy pasted and only the grid shows but no data.&quot;

I haven't seen a response, but I have a similar, odd situation where a cfform (flash)/cfgrid works just fine on my CF dev server (running atop the built in web server), but when I move the template to the production server (CF atop Apache 2.0) the grid comes up but no data. When I cfdump the same query that is used by the cfgrid, the data is all there (on the production server), but the flash form continues to show nothing. Any clues why this might be happening? Grateful for any suggestions....
Thomary
32. Thomary wrote on March 17, 2006 at 10:54 AM
I'm trying to do the same thing as James-but not a date field. Live Docs page:
http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/Tags-pt149.htm
Shows an expression on gridcolumn.
&lt;cfgridcolumn name = &quot;FirstName&quot; textColor = &quot;(CX EQ Pam ? blue : black)&quot;&gt;

I would really like to know how to use this. I have a MySql Query and the ASFusion ActionFilter Grid. The Grid has a varchar field Division. I want the Division to turn blue if it EQ 98. I can not get this to work. Is there a required setting to get this to work? I've tried the selectmode=&quot;row&quot;?
Thanks for your help.
Laura
CFSolar,
It seems that Flash remoting is not correctly set up in your production server. I can't help you with Apache, but I would go to Adobe's website to see how to set it up.

Thomary and James,
First, you should be looking at CF7's docs, not 6.
What you are doing does not work in Flash forms because you can only change the color of the whole column, not individual items.
I would use something like this:
http://www.asfusion.com/blog/entry/looping-over-the-records-of-a-large-cfgrid
to change the color of the row.
Thomary
34. Thomary wrote on March 17, 2006 at 11:43 AM
Thank you. I'm not very good at AS but I'll give it a shot. I have the &quot;AS for Flash MX&quot; book from O'Reilly but it seems to be for movies not forms. Thanks again.
c
35. c wrote on May 12, 2006 at 9:09 AM
Hi,
Is it possible to filter results using the date picker control with the cfgrid. My resultset has a date from SQL in the results field and I would like users to have two date picker controls so they only see info in a certain date range. Simply comparing the dates doens't seem to work and I assume it's got something to do with the date format, but I am new to flash and not sure how to tell what dates are being passed to the actionscript.
Jimmy
36. Jimmy wrote on May 18, 2006 at 4:01 PM
Hello,

I'm trying to filter the data also via 2 dates. A start date and an End date Based on these dates the grid will display the result from the query. Similar to what C is trying to do on the previous post. Can some please help.

Thanks
Jimmy
c
37. c wrote on May 19, 2006 at 6:00 AM
This is how I ended up narrowing by date, not very elegant but the work needed to convert the date string from my query didn't seem very elegant either:

(arrMembers[i].month_published.substring(6,10) > activityStart.selectedDate.getFullYear() ||
       (arrMembers[i].month_published.substring(6,10) == activityStart.selectedDate.getFullYear() &&
          arrMembers[i].month_published.substring(0,2) > activityStart.selectedDate.getMonth()))
Jimmy
38. Jimmy wrote on May 19, 2006 at 8:30 AM
Thanks for the info. I'm still new to this remote flashing, Do i just add the code to the action script section, and create 2 cfinput date box for input?

Thanks,
Jimmy
thomary
39. thomary wrote on May 19, 2006 at 11:30 AM
<!--- Used it to get variable in getArtists query   --->
<table align="center" width="100%"><tr><td valign="top">
<form action="firstfind.cfm?search=1" method="post" name="getinfo">
Enter the begining of the Last Name and click Find.
<input type="text" id="findme" name="findme" size="5">
<script type="text/javascript" language="JavaScript">
{ document.getElementById("findme").focus(); }
</script>
<input type="Submit" name="btnfind" value="Find">
<input type="hidden" name="btnfind">
</form>
</td></tr></table>

<cfif isdefined ("search") or isdefined("url.back")>

<cfform name="getinfo" format="flash" action="firstfind.cfm" method="post" height="560" onload="formOnLoad()" timeout="200">

<CFQUERY NAME="getArtists" DATASOURCE="docpersonnel">
SELECT *
FROM tblyourtablename
<cfif parameterExists(btnfind) and not parameterExists(url.back)>
WHERE tblyourtablename.LastName like '#form.findme#%'
</cfif>
<cfif parameterExists(url.back)>
WHERE tblyourtablename.EmployeeID = '#url.RecordID#'
</cfif>

ORDER BY tblyourtablename.LastName, tblyourtablename.FirstName
</CFQUERY>

<!--- Do grid here --->
</cfform>
thomary
40. thomary wrote on May 19, 2006 at 11:33 AM
Sorry, the above code was suppose to come after this message...
I got this from a coworker. It's a great idea. I had too many records to show the grid with every record.
So he said to do a regular html form first to get the variables set (like your dates, I used the LastName field. HTH...
Jimmy
41. Jimmy wrote on May 19, 2006 at 11:41 AM
Thanks for the post, Is this possible to do all in one page instead of 2 pages? I am able to do this on 2 pages, but I would like to do it on 1 page. Kinda similar to this link

https://reservations.ihotelier.com/onescreen.cfm?hotelid=3717&languageid=1

Thanks.

Jimmy
thomary
42. thomary wrote on May 19, 2006 at 12:09 PM
I wish I was that good.. The example page is great. I wonder if they are using flex? My example, I use the same page, it just loads the second form after the first part is entered. The user can make another entry in the first form again and again.
Jimmy
43. Jimmy wrote on May 19, 2006 at 12:19 PM
Thanks for your feed back. Is Flex an addon to Coldfusion, or is it a different language?
thomary
44. thomary wrote on May 19, 2006 at 12:49 PM
I've only seen the new Flex builder (beta). I'm told it's like coldfusion changes it to javascript - Flex builder changes it to action script. I really don't know what I'm talking about, I'm new to coldfusion myself. I will be getting more into the Flex builder in my job but thankfully, I'm still with ColdFusion for a while....
Sif Baksh
I was wondering if you had an example using cfformgroup type="accordion" instead of grids. I reused your code but not sure how to make the data change in cfformgroup.

Thanks in advance
Sif Baksh
OK I figured it out. You have to bind the data.
Franz
47. Franz wrote on February 26, 2007 at 6:29 AM
Hi,
i use this script to filter records from an oracle db. The difference is that i use as filter a year.
arrMembers[i].year == myselect1.value
But it doesn't work.
Is there a problem with numbers?

thanks
Adrian
48. Adrian wrote on October 17, 2007 at 3:27 PM
Hi,

I'm new to this, but how do you get the cfgrid data in this example with the filter applied to post? I added a method, action, and submit button with no luck.

Thanks
Adrian
49. Adrian wrote on October 17, 2007 at 3:43 PM
I added a checkbox and if I don't filter the grid I can get the records I checked or the record I click on.

If I filter I can't get anything to post.

Can anyone shed some light?

Thanks!

Leave your comment

Comment etiquette: As a gesture to those subscribed to this post, please keep your comments relevant to the post.

Your email address will never be displayed.
Email is gravatar enabled.Gravatar are the pictures you see next to the comments. If you like to have one, visit gravatar



Allowed tags:

<code>
All other tags will be shown as such, when in doubt, use the preview.

Leave this field empty:


Preview:

Refresh Preview
1. You wrote on