<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Axelology &#187; cfform</title>
	<atom:link href="http://www.axelscript.com/category/cfform/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.axelscript.com</link>
	<description>Axel Jensen on Flex, Coldfusion and... other stuff</description>
	<lastBuildDate>Thu, 29 Dec 2011 17:03:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Working with cfselect in cfform</title>
		<link>http://www.axelscript.com/2008/02/13/working-with-cfselect-in-cfform/</link>
		<comments>http://www.axelscript.com/2008/02/13/working-with-cfselect-in-cfform/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 20:45:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[cfform]]></category>
		<category><![CDATA[Coldfusion]]></category>

		<guid isPermaLink="false">http://www.axelscript.com/2008/02/13/working-with-cfselect-in-cfform/</guid>
		<description><![CDATA[There was a post on an adobe forum wondering how to go about doing this, they state that they go on and on looking for how to do this, and so i&#8217;m gonna help&#8217;em out&#8230; View the example Download the File the basis of what they want to do is rather easy, but the error [...]]]></description>
			<content:encoded><![CDATA[<p class="body">There was a post on an adobe forum wondering how to go about doing this, they state that they go on and on looking for how to do this, and so i&#8217;m gonna help&#8217;em out&#8230;</p>
<p><span id="more-49"></span></p>
<p><a href="http://axelscript.com/wp-content/cfwtExamples/Working-with-cfselect-in-cfform/" target="_blank">View the example</a><br />
<a href="http://axelscript.com/wp-content/cfwtExamples/Working-with-cfselect-in-cfform/Working-with-cfselect-in-cfform.zip" target="_blank">Download the File</a><br />
the basis of what they want to do is rather easy, but the error handling in cfform when the format is flash, is SOOOOO HARD TOOO DEBUG!</p>
<p>1. Call the setUp() function in the onload=&#8221;setUp();&#8221; in the beginning form tag that your going to create further into the lesson.</p>
<p class="code"><span style="color: #800000">&lt;cfform name=<span style="color: #0000ff">&#8220;Performance&#8221;</span><br />
timeout=<span style="color: #0000ff">&#8220;500&#8243;</span> height=<span style="color: #0000ff">&#8220;800&#8243;</span> width=<span style="color: #0000ff">&#8220;800&#8243;</span><br />
format=<span style="color: #0000ff">&#8220;flash&#8221;</span> skin=<span style="color: #0000ff">&#8220;haloSilver&#8221;</span><br />
action=<span style="color: #0000ff">&#8220;action.cfm&#8221;</span> method=<span style="color: #0000ff">&#8220;post&#8221;</span><br />
onload=<span style="color: #0000ff">&#8220;setUp();&#8221;</span>&gt;</span></p>
<p>2. Create a cfformitem type=&#8221;script&#8221; right under the cfform tag and create your setUp function as well as another function we are going to call, when one of your select boxes change.</p>
<p class="code"><span style="color: #800000">&lt;cfformitem type=<span style="color: #0000ff">&#8220;script&#8221;</span>&gt;</span><br />
public function setUp():Void{<br />
School.enabled = false;<br />
}<br />
public function changeStatus(status):Void{<br />
if (Title.selectedItem.data == 1){<br />
<span style="color: #808080"><em>   //this is case sensitive so be careful</em></span><br />
School.enabled = status;<br />
}<br />
}<br />
<span style="color: #800000">&lt;/cfformitem&gt;</span></p>
<p>3.  Create Your two cfselects, and call the changeStatus() function in the onChange=&#8221;" event of the first one.</p>
<p class="code"><span style="color: #800000">&lt;cfselect name=<span style="color: #0000ff">&#8220;Title&#8221;</span><br />
label=<span style="color: #0000ff">&#8220;Title&#8221;</span> width=<span style="color: #0000ff">&#8220;200&#8243;</span><br />
tooltip=<span style="color: #0000ff">&#8220;Please enter appropiate title.&#8221;</span><br />
required=<span style="color: #0000ff">&#8220;Yes&#8221;</span> onChange=<span style="color: #0000ff">&#8220;changeStatus(true)&#8221;</span> &gt;</span></p>
<p><span style="color: #000080"><span style="color: #ff8000">&lt;option&gt;</span></span>Select<span style="color: #000080"><span style="color: #ff8000">&lt;/option&gt;</span></span><br />
<span style="color: #000080"><span style="color: #ff8000">&lt;option value = <span style="color: #0000ff">&#8220;0&#8243;</span>&gt;</span></span><br />
Asso. &amp; Asst. Deans<br />
<span style="color: #000080"><span style="color: #ff8000">&lt;/option&gt;</span></span><br />
<span style="color: #000080"><span style="color: #ff8000">&lt;option value = <span style="color: #0000ff">&#8220;1&#8243;</span>&gt;</span></span><br />
Asso. &amp; Asst. Provost &amp; VPs<br />
<span style="color: #000080"><span style="color: #ff8000">&lt;/option&gt;</span></span><br />
<span style="color: #000080"><span style="color: #ff8000">&lt;option value = <span style="color: #0000ff">&#8220;2&#8243;</span>&gt;</span></span><br />
Campus Directors<br />
<span style="color: #000080"><span style="color: #ff8000">&lt;/option&gt;</span></span><br />
<span style="color: #800000">&lt;/cfselect&gt;</span></p>
<p><span style="color: #800000">&lt;cfselect name=<span style="color: #0000ff">&#8220;School&#8221;</span> width=<span style="color: #0000ff">&#8220;200&#8243;</span> required=<span style="color: #0000ff">&#8220;Yes&#8221;</span> &gt;</span></p>
<p><span style="color: #000080"><span style="color: #ff8000">&lt;option&gt;</span></span><br />
Select<br />
<span style="color: #000080"><span style="color: #ff8000">&lt;/option&gt;</span></span><br />
<span style="color: #000080"><span style="color: #ff8000">&lt;option value=<span style="color: #0000ff">&#8220;1&#8243;</span>&gt;</span></span><br />
Dyson<br />
<span style="color: #000080"><span style="color: #ff8000">&lt;/option&gt;</span></span><br />
<span style="color: #000080"><span style="color: #ff8000">&lt;option value =<span style="color: #0000ff">&#8220;2&#8243;</span>&gt;</span></span><br />
Education<br />
<span style="color: #000080"><span style="color: #ff8000">&lt;/option&gt;</span></span></p>
<p><span style="color: #800000">&lt;/cfselect&gt;</span></p>
<p><span style="color: #000080"><span style="color: #ff8000">&lt;/form&gt;</span></span></p>
<p>Hope this helps&#8230; take a look at the example.</p>
<img src="http://www.axelscript.com/?ak_action=api_record_view&id=49&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.axelscript.com/2008/02/13/working-with-cfselect-in-cfform/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using cfform, making a datefield be a preselected Year</title>
		<link>http://www.axelscript.com/2008/02/11/using-cfform-making-a-datefield-be-a-preselected-year/</link>
		<comments>http://www.axelscript.com/2008/02/11/using-cfform-making-a-datefield-be-a-preselected-year/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 18:35:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[cfform]]></category>

		<guid isPermaLink="false">http://www.axelscript.com/2008/02/11/using-cfform-making-a-datefield-be-a-preselected-year/</guid>
		<description><![CDATA[Somebody once told me they didn&#8217;t like flash forms because they were far too limited, I agree that flex is a better choice after using flex&#8230; but I would also say, that flash forms in coldfusion 7.0.2 have their own place as well&#8230; The following example shows how to use cfform format=&#8221;flash&#8221; and make a [...]]]></description>
			<content:encoded><![CDATA[<p class="body">Somebody once told me they didn&#8217;t like flash forms because they were far too limited, I agree that flex is a better choice after using flex&#8230; but I would also say, that flash forms in coldfusion 7.0.2 have their own place as well&#8230;</p>
<p><span id="more-46"></span><br />
The following example shows how to use cfform format=&#8221;flash&#8221; and make a datefield a preselected Date&#8230; it&#8217;s such a simple example&#8230; i&#8217;m not quite sure why i should even blog it, but you never know who might need it.</p>
<p><a href="http://axelscript.com/wp-content/cfwtExamples/Using-a-Predefined-Date/index.cfm" target="_blank">View Example</a></p>
<p><a href="http://axel.cfwebtools.com/Examples/Using-a-Predefined-Date/Using-a-Predefined-Date.zip" target="_blank">Download Example</a></p>
<p class="code"><span style="color: #800000">&lt;cfform<br />
name=<span style="color: #0000ff">&#8220;myForm&#8221;</span><br />
format=<span style="color: #0000ff">&#8220;flash&#8221;</span><br />
width=<span style="color: #0000ff">&#8220;350&#8243;</span> height=<span style="color: #0000ff">&#8220;250&#8243;</span>&gt;</span></p>
<p><span style="color: #800000">&lt;cfinput name=<span style="color: #0000ff">&#8220;startDate&#8221;</span> type=<span style="color: #0000ff">&#8220;datefield&#8221;</span><br />
label=<span style="color: #0000ff">&#8220;date:&#8221;</span> mask=<span style="color: #0000ff">&#8220;mm/dd/yyyy&#8221;</span> value=<span style="color: #0000ff">&#8220;03/06/1983&#8243;</span><br />
/&gt;</span></p>
<p><span style="color: #800000">&lt;/cfform&gt;</span></p>
<img src="http://www.axelscript.com/?ak_action=api_record_view&id=46&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.axelscript.com/2008/02/11/using-cfform-making-a-datefield-be-a-preselected-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filter Function for cf flash forms</title>
		<link>http://www.axelscript.com/2008/02/10/filter-function-for-cf-flash-forms/</link>
		<comments>http://www.axelscript.com/2008/02/10/filter-function-for-cf-flash-forms/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 17:50:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[cfform]]></category>
		<category><![CDATA[Coldfusion]]></category>

		<guid isPermaLink="false">http://www.axelscript.com/2008/02/10/filter-function-for-cf-flash-forms/</guid>
		<description><![CDATA[Use this to filter data in a datagrid I always get scared that asfusions blog isn&#8217;t going to be available, one day i went there, and the blog and examples part was totally gone, i was freaking out, i go there as a reference all the time&#8230; Here is a function i use alot, and [...]]]></description>
			<content:encoded><![CDATA[<p class="body">Use this to filter data in a datagrid</p>
<p> I always get scared that asfusions blog isn&#8217;t going to be available, one day i went there, and the blog and examples part was totally gone, i was freaking out, i go there as a reference all the time&#8230; Here is a function i use alot, and so i&#8217;m going to blog it as well as it is available on asfusion.com</p>
<p><span id="more"></span>when i get some time i&#8217;ll see if this code works, sometimes when copying and pasting the code into this blogger software i use&#8230; some lines dont go in right&#8230; but i know it works, because i use it on&#8230; <a href="http://www.beta.killtheheart.com/" target="_blank">beta.killtheheart.com</a></p>
<p><span id="more-19"></span></p>
<p class="code">function applyFilter( term:String, grid:mx.controls.DataGrid, columns:Array ):Void {</p>
<p>var filterTerm:String = term.toString().toLowerCase();</p>
<p>if(filterTerm.length &gt; 0) {<br />
if(_global.unfilteredData[grid.id] == undefined){<br />
if (_global.unfilteredData == undefined){<br />
_global.unfilteredData = {};<br />
}<br />
_global.unfilteredData[grid.id]  = grid.dataProvider.slice(<span style="color: #0000ff">0</span>);<br />
}</p>
<p>var filteredData:Array = [];</p>
<p>for(var i = 0; i&lt; _global.unfilteredData[grid.id].length; i++) {<br />
var item:Object =  _global.unfilteredData[grid.id][i];<br />
var added:Boolean = false;</p>
<p>for(var j = 0; j&lt; columns.length; j++){<br />
if(!added){<br />
var value:String = item[columns[j]].toString().toLowerCase();<br />
if(value.indexOf(filterTerm) != -1)   {<br />
filteredData.push(item);<br />
added = true;<br />
}<br />
}<br />
else {<br />
break;<br />
}<br />
}<br />
}</p>
<p>grid.dataProvider = filteredData;</p>
<p>}<br />
else {<br />
if(_global.unfilteredData[grid.id] != undefined) grid.dataProvider = _global.unfilteredData[grid.id];<br />
}<br />
}</p>
<img src="http://www.axelscript.com/?ak_action=api_record_view&id=19&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.axelscript.com/2008/02/10/filter-function-for-cf-flash-forms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Use a combo box in a CFGrid</title>
		<link>http://www.axelscript.com/2008/02/10/use-a-combo-box-in-a-cfgrid/</link>
		<comments>http://www.axelscript.com/2008/02/10/use-a-combo-box-in-a-cfgrid/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 17:45:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[cfform]]></category>
		<category><![CDATA[Coldfusion]]></category>

		<guid isPermaLink="false">http://www.axelscript.com/2008/02/10/use-a-combo-box-in-a-cfgrid/</guid>
		<description><![CDATA[This is a great example, and it&#8217;s great for learning what actionscript can do&#8230; It uses an import of an actionscript file to put a combo box in a cell in a cfgrid&#8230; it&#8217;s awesome.View the example Here is the original Post I want to be able to remember this stuff so i blog it. [...]]]></description>
			<content:encoded><![CDATA[<p class="body">This is a great example, and it&#8217;s great for learning what actionscript can do&#8230; It uses an import of an actionscript file to put a combo box in a cell in a cfgrid&#8230; it&#8217;s awesome.<a href="http://axel.cfwebtools.com/examples/Use-a-combobox-in-a-cfgrid/Grid.cfm" target="_blank">View the example</a><br />
<span id="more"></span><br />
<a href="http://cfpim.blogspot.com/2005/08/grid-cellrenderer-in-flash-forms.html" target="_blank">Here is the original Post</a> I want to be able to remember this stuff so i blog it.<br />
Grid.cfm<br />
&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p class="code"><span style="color: #800000">&lt;cfif parameterExists(form.submit_btn)&gt;</span><br />
<span style="color: #800000">&lt;CFDUMP var=<span style="color: #0000ff">&#8220;#form#&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;/cfif&gt;</span></p>
<p><span style="color: #800000">&lt;cfform format=<span style="color: #0000ff">&#8220;Flash&#8221;</span> skin=<span style="color: #0000ff">&#8220;haloSilver&#8221;</span> width=<span style="color: #0000ff">&#8220;400&#8243;</span> height=<span style="color: #0000ff">&#8220;300&#8243;</span>&gt;</span></p>
<p><span style="color: #800000">&lt;cfsaveContent variable=<span style="color: #0000ff">&#8220;onLoad&#8221;</span>&gt;</span><br />
function(){<br />
_level0.myGrid.rowHeight=25;<br />
<span id="more-18"></span><br />
<span style="color: #808080"><em> //applying the cellRenderer &#8216;GridRenderer.as&#8217; to the 4th column</em></span> _level0.myGrid.getColumnAt(<span style="color: #0000ff">3</span>).cellRenderer = GridRenderer;</p>
<p>}.call()<br />
<span style="color: #800000">&lt;/cfsavecontent&gt;</span></p>
<p><span style="color: #808080"><em>&lt;!&#8212; grid with 3 columns name, firstName, department &#8212;&gt;</em></span><br />
<span style="color: #800000">&lt;cfgrid name=<span style="color: #0000ff">&#8220;myGrid&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfgridColumn name=<span style="color: #0000ff">&#8220;name&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfgridColumn name=<span style="color: #0000ff">&#8220;firstName&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfgridColumn name=<span style="color: #0000ff">&#8220;department&#8221;</span>&gt;</span></p>
<p><span style="color: #800000">&lt;cfgridrow data=<span style="color: #0000ff">&#8220;Maegerman, Philippe,<span style="color: #0000ff"> 1</span>&#8220;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfgridrow data=<span style="color: #0000ff">&#8220;Fonda, Nahuel,<span style="color: #0000ff"> 2</span>&#8220;</span>&gt;</span><br />
<span style="color: #800000">&lt;/cfgrid&gt;</span></p>
<p><span style="color: #800000">&lt;cfinput type=<span style="color: #0000ff">&#8220;submit&#8221;</span> name=<span style="color: #0000ff">&#8220;submit_btn&#8221;</span> value=<span style="color: #0000ff">&#8220;Submit to see the form dump&#8221;</span>&gt;</span><br />
<span style="color: #808080"><em>&lt;!&#8212; onLoad trigger &#8212;&gt;</em></span><br />
<span style="color: #800000">&lt;cfinput type=<span style="color: #0000ff">&#8220;text&#8221;</span> visible=<span style="color: #0000ff">&#8220;No&#8221;</span> width=<span style="color: #0000ff">&#8220;0&#8243;</span> height=<span style="color: #0000ff">&#8220;0&#8243;</span> name=<span style="color: #0000ff">&#8220;trigger2&#8243;</span> bind=<span style="color: #0000ff">&#8220;{1==2?&#8221;:#onLoad#}&#8221;</span>&gt;</span></p>
<p><span style="color: #800000">&lt;/cfform&gt;</span></p>
<p>and here is the actionscript file that is needed, put them in the same directory, and it will work.</p>
<p>GridRenderer.as<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p class="code">import mx.controls.ComboBox;</p>
<p>class GridRenderer extends mx.core.UIComponent{</p>
<p>var combo;<br />
var listOwner : MovieClip;<br />
var getCellIndex : Function;<br />
var getDataLabel : Function;</p>
<p>function createChildren(Void) : Void{<br />
combo = createClassObject( ComboBox, <span style="color: #0000ff">&#8220;combo&#8221;</span>,<span style="color: #0000ff"> 1</span>, {owner:this});<br />
combo.dataProvider = [{data:1,label:'CF_Pim'}, {data:2,label:'AsFusion'}];<br />
combo.addEventListener(<span style="color: #0000ff">&#8220;change&#8221;</span>, this);<br />
}</p>
<p>function getPreferredHeight(Void) : Number{<br />
return combo != undefined ? 25:0;<br />
}</p>
<p>function setValue(str:String, item:Object){<br />
var val = item.department;<br />
for(var i = 0; i &lt; combo.dataProvider.length; i++){<br />
combo.dataProvider[i].data == val ? combo.selectedIndex = i : &#8221;;<br />
}<br />
}</p>
<p>function change() {<br />
listOwner.editField(getCellIndex().itemIndex,<br />
getDataLabel(), combo.selectedItem.data);<br />
}<br />
}</p>
<p><a href="http://axel.cfwebtools.com/examples/Use-a-combobox-in-a-cfgrid/Grid.cfm" target="_blank">View the example</a></p>
<img src="http://www.axelscript.com/?ak_action=api_record_view&id=18&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.axelscript.com/2008/02/10/use-a-combo-box-in-a-cfgrid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Javascript in flash forms</title>
		<link>http://www.axelscript.com/2008/02/09/use-javascript-in-flash-forms/</link>
		<comments>http://www.axelscript.com/2008/02/09/use-javascript-in-flash-forms/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 19:08:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[cfform]]></category>
		<category><![CDATA[Coldfusion]]></category>

		<guid isPermaLink="false">http://www.axelscript.com/2008/02/09/use-javascript-in-flash-forms/</guid>
		<description><![CDATA[Here is a way that you can use javascript with flash forms, we ran into a situation where the flash form got so big on the page, that we had to use javascript to scroll to the top of the page&#8230; View The example Download the files &#60;cfsavecontent variable=&#8220;doThis&#8221;&#62; getURL(&#8220;javascript:showMessage(&#8220; + &#8220;&#8216;test&#8217;&#8221; + &#8220;)&#8221;); &#60;/cfsavecontent&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>		Here is a way that you can use javascript with flash forms,</p>
<p>we ran into a situation where the flash form got so big on the page, that we had to use javascript to scroll to the top of the page&#8230;</p>
<p><a href="http://axelscript.com/wp-content/cfwtExamples/use-javascript-with-flash-forms/use-javascript-with-flash-forms.cfm" target="_blank">View The example</a></p>
<p><a href="http://axelscript.com/wp-content/cfwtExamples/use-javascript-with-flash-forms/use-javascript-with-flash-forms.zip" target="_blank">Download the files</a></p>
<p class="code"><span style="color: #800000">&lt;cfsavecontent variable=<span style="color: #0000ff">&#8220;doThis&#8221;</span>&gt;</span><br />
getURL(<span style="color: #0000ff">&#8220;javascript:showMessage(&#8220;</span> + <span style="color: #0000ff">&#8220;&#8216;test&#8217;&#8221;</span> + <span style="color: #0000ff">&#8220;)&#8221;</span>);<br />
<span style="color: #800000">&lt;/cfsavecontent&gt;</span><br />
<span style="color: #000080"><span style="color: #800000">&lt;script language=<span style="color: #0000ff">&#8220;javascript&#8221;</span>&gt;</span></span><br />
function showMessage(msg)<br />
{<br />
alert(msg);<br />
}<br />
<span id="more-9"></span><br />
<span style="color: #000080"><span style="color: #800000">&lt;/script&gt;</span></span></p>
<p><span style="color: #800000">&lt;cfform name=<span style="color: #0000ff">&#8220;myform&#8221;</span> height=<span style="color: #0000ff">&#8220;200&#8243;</span> width=<span style="color: #0000ff">&#8220;200&#8243;</span> format=<span style="color: #0000ff">&#8220;Flash&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfinput type=<span style="color: #0000ff">&#8220;button&#8221;</span> name=<span style="color: #0000ff">&#8220;test&#8221;</span> value=<span style="color: #0000ff">&#8220;test&#8221;</span> onClick=<span style="color: #0000ff">&#8220;#doThis#&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;/cfform&gt;</span></p>
<p><span id="more"></span><br />
I use it on my site to invoke javascript and ajax</p>
<img src="http://www.axelscript.com/?ak_action=api_record_view&id=9&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.axelscript.com/2008/02/09/use-javascript-in-flash-forms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Submit a cfgrid to the session!</title>
		<link>http://www.axelscript.com/2008/02/09/submit-a-cfgrid-to-the-session/</link>
		<comments>http://www.axelscript.com/2008/02/09/submit-a-cfgrid-to-the-session/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 18:45:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[cfform]]></category>
		<category><![CDATA[Coldfusion]]></category>

		<guid isPermaLink="false">http://www.axelscript.com/2008/02/09/submit-a-cfgrid-to-the-session/</guid>
		<description><![CDATA[The challenge with using cfgrid, is that it doesnt exist in the form in nothing was changed&#8230;. here is a script that runs through the grid, and gets the values and puts them in the form scope&#8230; You can use this to submit to the session, or another scope of some sort. The code is [...]]]></description>
			<content:encoded><![CDATA[<p class="body"> 		The challenge with using cfgrid, is that it doesnt exist in the form in nothing was changed&#8230;. here is a script that runs through the grid, and gets the values and puts them in the form scope&#8230; You can use this to submit to the session, or another scope of some sort.  The code is based on another great site! asfusion, fantastic examples, and they are how i got knowledgable of the subject.</p>
<p><a href="http://axelscript.com/wp-content/cfwtExamples/loop%20over%20a%20cfgrid/" target="_blank">View the example</a></p>
<p><span id="more-7"></span><br />
<span id="more"></span><br />
<a href="http://www.asfusion.com/examples/item/looping-over-the-records-of-a-large-cfgrid">asfusion Looping over records of a large grid</a>I slightly modified thier code</p>
<p class="code"><span style="color: #800000">&lt;cfif isDefined(&#8216;form&#8217;)&gt;</span><br />
<span style="color: #800000">&lt;cfdump var=<span style="color: #0000ff">&#8220;#form#&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;/cfif&gt;</span><br />
<span style="color: #808080"><em>&lt;!&#8212; replace this cfscript by your query: &lt;cfquery name=<span style="color: #0000ff">&#8220;products&#8221;</span>&gt; &#8212;&gt;</em></span><br />
<span style="color: #800000">&lt;cfscript&gt;</span><br />
<span style="color: #808080"><em>   //generate a large query</em></span><br />
products = queryNew(<span style="color: #0000ff">&#8220;&#8221;</span>);<br />
names = <span style="color: #0000ff">&#8220;&#8221;</span>;<br />
prices = <span style="color: #0000ff">&#8220;&#8221;</span>;<br />
for (i = 1; i LTE 25; i = i + 1){<br />
names = listappend(names,<span style="color: #0000ff">&#8220;Product &#8220;</span> &amp; i,<span style="color: #0000ff">&#8220;,&#8221;</span>);<br />
prices = listappend(prices,<span style="color: #0000ff">100</span> + i,<span style="color: #0000ff">&#8220;,&#8221;</span>);<br />
}<br />
queryaddcolumn(products,<span style="color: #0000ff">&#8220;name&#8221;</span>,listtoarray(names));<br />
queryaddcolumn(products,<span style="color: #0000ff">&#8220;price&#8221;</span>,listtoarray(prices));<br />
<span style="color: #800000">&lt;/cfscript&gt;</span></p>
<p><!-- more --> <span style="color: #800000">&lt;cfsavecontent variable=<span style="color: #0000ff">&#8220;changePrice&#8221;</span>&gt;</span><br />
var i = 0;<br />
updateBtn.enabled = false;</p>
<p><span style="color: #808080"><em>   //make the loop with onEnterFrame instead of a <span style="color: #0000ff">&#8220;for&#8221;</span></em></span><br />
_root.onEnterFrame = function ()<br />
{<br />
if(i &lt; productsGrid.length) {<br />
<span style="color: #808080"><em>   //do one iteration of the loop</em></span><br />
_root.updatePrice(i);<br />
i++;<br />
}<br />
else  {<br />
<span style="color: #808080"><em>   //end the loop</em></span><br />
_root.onEnterFrame = undefined;<br />
updateBtn.enabled = true;<br />
}<br />
}</p>
<p><span style="color: #808080"><em>   //the function that does whatever we need in each iteration</em></span><br />
_root.updatePrice = function (index){<br />
productsGrid.editField(index, &#8216;price&#8217;, Number(productsGrid.getItemAt(index)['price']));<br />
productsGrid.setPropertiesAt(index, {backgroundColor:0xF7FFB7});<br />
}<br />
<span style="color: #800000">&lt;/cfsavecontent&gt;</span></p>
<p><span style="color: #000080">&lt;!DOCTYPE HTML PUBLIC <span style="color: #0000ff">&#8220;<span style="color: #808080"><em>-//W3C//DTD HTML 4.01 Transitional//EN&#8221;</em></span><em> <span style="color: #0000ff">&#8220;<a href="http://www.w3.org/TR/html4/loose.dtd" target="_blank">http://www.w3.org/TR/html4/loose.dtd</a>&#8220;</span>&gt;</em></span></span> <span style="color: #000080">&lt;html&gt;</span><br />
<span style="color: #000080">&lt;head&gt;</span><br />
<span style="color: #000080">&lt;meta http-equiv=<span style="color: #0000ff">&#8220;Content-Type&#8221;</span> content=<span style="color: #0000ff">&#8220;text/html; charset=iso-8859-1&#8243;</span>&gt;</span><br />
<span style="color: #000080">&lt;title&gt;</span>Looping over a large cfgrid<span style="color: #000080">&lt;/title&gt;</span><br />
<span style="color: #000080">&lt;/head&gt;</span><br />
<span style="color: #000080">&lt;body &gt;</span><br />
<span style="color: #800000">&lt;cfform name=<span style="color: #0000ff">&#8220;myForm&#8221;</span> format=<span style="color: #0000ff">&#8220;flash&#8221;</span>  width=<span style="color: #0000ff">&#8220;350&#8243;</span> height=<span style="color: #0000ff">&#8220;250&#8243;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfformitem type=<span style="color: #0000ff">&#8220;text&#8221;</span>&gt;</span>Click Update then submit the form.<span style="color: #800000">&lt;/cfformitem&gt;</span><br />
<span style="color: #800000">&lt;cfformgroup type=<span style="color: #0000ff">&#8220;vBox&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfgrid name= <span style="color: #0000ff">&#8220;productsGrid&#8221;</span> query=<span style="color: #0000ff">&#8220;products&#8221;</span> height=<span style="color: #0000ff">&#8220;150&#8243;</span> rowheaders=<span style="color: #0000ff">&#8220;false&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfgridcolumn name=<span style="color: #0000ff">&#8220;name&#8221;</span> header=<span style="color: #0000ff">&#8220;Product&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfgridcolumn name=<span style="color: #0000ff">&#8220;price&#8221;</span> header=<span style="color: #0000ff">&#8220;Price&#8221;</span> type=<span style="color: #0000ff">&#8220;numeric&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;/cfgrid&gt;</span><br />
<span style="color: #800000">&lt;cfformgroup type=<span style="color: #0000ff">&#8220;horizontal&#8221;</span> style=<span style="color: #0000ff">&#8220;horizontalAlign:right;&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;cfinput type=<span style="color: #0000ff">&#8220;button&#8221;</span> name=<span style="color: #0000ff">&#8220;updateBtn&#8221;</span> value=<span style="color: #0000ff">&#8220;Update&#8221;</span> onclick=<span style="color: #0000ff">&#8220;#changePrice#&#8221;</span>&gt;</span></p>
<p><span style="color: #800000">&lt;cfinput type=<span style="color: #0000ff">&#8220;submit&#8221;</span> name=<span style="color: #0000ff">&#8220;submit&#8221;</span> value=<span style="color: #0000ff">&#8220;submit&#8221;</span>&gt;</span><br />
<span style="color: #800000">&lt;/cfformgroup&gt;</span><br />
<span style="color: #800000">&lt;/cfformgroup&gt;</span><br />
<span style="color: #800000">&lt;/cfform&gt;</span><br />
<span style="color: #000080">&lt;/body&gt;</span><br />
<span style="color: #000080">&lt;/html&gt;</span></p>
<p>Keep in mind it&#8217;s a work around so the code probably won&#8217;t work with the next version</p>
<p><strong>THIS WILL SUCK IF YOU ARE ENTERING OR UPDATING MORE THAN A FEW HUNDRED RECORDS or updating a lot of columns&#8230;</strong></p>
<img src="http://www.axelscript.com/?ak_action=api_record_view&id=7&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.axelscript.com/2008/02/09/submit-a-cfgrid-to-the-session/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

