Scott asks:
Ray, I'm starting work on an invoicing app, and I'd like to do it entirely with Flash Forms. For my line items I'd like to use a cfgrid, but the fact that the flash format of cfgrid doesn't support a select box (for part number selection) pretty much kills that idea. Another other ideas for a good implementation of this?
I've run into this problem as well. What I've done is use a combination of a grid and a detail panel below. When a row is selected in the grid, the details populate in the panel below. The only issue is that you can't use bind on cfselect. However, you can use the onChange attribute in the grid tree. Below is a simple example. The text field uses bind whereas the select is populated via onChange. I hope this helps.
<cfset q = queryNew("name,age,gender")>
<cfloop index="x" from="1" to="10">
<cfset queryAddRow(q)>
<cfset querySetCell(q, "name", "Name #x#")>
<cfset querySetCell(q, "age", randRange(20,50) )>
<cfif x mod 2>
<cfset querySetCell(q, "gender", "Male")>
<cfelse>
<cfset querySetCell(q, "gender", "Female")>
</cfif>
</cfloop>
<cfform format="flash" name="foo" width="400">
<cfgrid name="people" query="q" rowHeaders=false
onChange="if( people.dataProvider[people.selectedIndex]['gender'] ==
'Male' ) { gender.selectedIndex=0; } else {
gender.selectedIndex=1; }">
<cfgridcolumn name="name" header="Name">
<cfgridcolumn name="age">
<cfgridcolumn name="gender" display="false">
</cfgrid>
<cfinput type="text" name="moo" bind="{people.dataProvider[people.selectedIndex]['name']}">
<cfselect name="gender" bind="{people.dataProvider[people.selectedIndex]['gender']}">
<option value="Male">Male</option>
<option value="Female">Female</option>
</cfselect>
</cfform>
<cfloop index="x" from="1" to="10">
<cfset queryAddRow(q)>
<cfset querySetCell(q, "name", "Name #x#")>
<cfset querySetCell(q, "age", randRange(20,50) )>
<cfif x mod 2>
<cfset querySetCell(q, "gender", "Male")>
<cfelse>
<cfset querySetCell(q, "gender", "Female")>
</cfif>
</cfloop>
<cfform format="flash" name="foo" width="400">
<cfgrid name="people" query="q" rowHeaders=false
onChange="if( people.dataProvider[people.selectedIndex]['gender'] ==
'Male' ) { gender.selectedIndex=0; } else {
gender.selectedIndex=1; }">
<cfgridcolumn name="name" header="Name">
<cfgridcolumn name="age">
<cfgridcolumn name="gender" display="false">
</cfgrid>
<cfinput type="text" name="moo" bind="{people.dataProvider[people.selectedIndex]['name']}">
<cfselect name="gender" bind="{people.dataProvider[people.selectedIndex]['gender']}">
<option value="Male">Male</option>
<option value="Female">Female</option>
</cfselect>
</cfform>
Archived Comments
I was going to ask you something but after spending the last tow days doing a Window$ reinstall have forgotten what :)
Glad your new battery seems to be better.
Ah now I remember!
ColdFusion MX 7 apparently is much better at "sourceless deployment" of CFML apps as Java bytecode. What is the best way to go about testing this with an existing application?
TIA!
PT
http://www.actcfug.com/
What if your "Detail Pane" has a dozen query-driven select boxes (i.e. ContactID, BusUnitID, CostCenterID, LocationID, DeptID, etc.)? Each select list box query can grow and shrink as records are added to the "Lookup Fields" so it all has to be dynamic... is there hope? You could really save my bacon here.
Michael:
You should check out www.asfusion.com - they have a post on how to populate a dynamic query driven cfselect using flash remoting - which could be initiated by the selection of a gridrow. I've had success implemeting this technique, but I've been having massive problems trying to get these cfselects bound back to the grid. Check it out, if you can figure out the binding, please let me know. toddsharp@zoominternet.net
Michael - see Todd's post - however - I assume you aren't talking about flash remoting though. My example in this post is pretty static (male/female). I'll post another blog entry tonight showing binding a cfselect that is more dynamic, ok?
I have a query that will return over 1,000 records to my contacts flash cfgrid. This of course is not ideal. Does anyone know how to implement paging , showing next, previous, and/or 1 of 50 of the available records using cf, flash forms, and cfgrid?
I am new to flash forms with Cold Fusion 8 and cannot get a cfselect to work with a cfgrid.
When you select an item in the select it should load the grid with the correct data.
I'd then like to be able to check the data I want in the grid and save it.
This image will show what I am trying to do.
http://i21.tinypic.com/2d6w...
Can anyone help?
Thanks