<?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>SpinOneSolutions &#187; CommonSpot</title>
	<atom:link href="http://www.spinonesolutions.com/tag/commonspot/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.spinonesolutions.com</link>
	<description>I waste my time so that you don't have to...</description>
	<lastBuildDate>Mon, 16 May 2011 17:01:16 +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>CommonSpot Developer Tips and Tricks</title>
		<link>http://www.spinonesolutions.com/2009/04/commonspot-developer-tips-and-tricks/</link>
		<comments>http://www.spinonesolutions.com/2009/04/commonspot-developer-tips-and-tricks/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 21:00:30 +0000</pubDate>
		<dc:creator>Will Wright</dc:creator>
				<category><![CDATA[CommonSpot]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[Paper Thin]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://www.spinonesolutions.com/?p=242</guid>
		<description><![CDATA[Here are some Tips and Tricks that I learned during the CommonSpot developer training. I&#8217;ve found them useful while working in this CMS so maybe you will too! Debug Settings Add this to the end of your site&#8217;s URL to fire up the debug settings. /loader.cfm?csmodule=utilities/debug-settings Cacheing Don&#8217;t want your element to cache while you&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some Tips and Tricks that I learned during the CommonSpot developer training. I&#8217;ve found them useful while working in this CMS so maybe you will too!</p>
<h3>Debug Settings</h3>
<p>Add this to the end of your site&#8217;s URL to fire up the debug settings.</p>
<p><code>/loader.cfm?csmodule=utilities/debug-settings</code></p>
<h3>Cacheing</h3>
<p>Don&#8217;t want your element to cache while you&#8217;re developing it?!  Add this single line to the top of your renderhandler.</p>
<p><code>request.element.isStatic = 0</code></p>
<p>Want to clear the cache?  Go for it; stick this querystring on your working URL.</p>
<p><code>?resetutils</code></p>
<h3>Site Administration</h3>
<p>Need access to the Site Administration?  Of course you do, you&#8217;re the developer!  Replace the current page with this and you&#8217;re there.</p>
<p><code>loader.cfm?csModule=admin/site-menu&amp;showSiteConfig=1</code></p>
<h3>Custom Element Details</h3>
<p>Get details about a custom element straight from the DB.  cfdump the results of this query.  I&#8217;m querying element 1342 in this instance, notice the WHERE clause.</p>
<p><code>&lt;cfquery name="myQuery" datasource="#request.site.datasource#"&gt;<br />
    SELECT d1.ID,<br />
        d1.FormName,<br />
        d1.Method,<br />
        d1.Action,<br />
        d1.DateCreated,<br />
        d1.DateLastModified,<br />
        d1.OwnerID,<br />
       <br />
        d2.ID as inputID,<br />
        d2.fieldName,<br />
        d2.shared,<br />
        d2.type as inputType,<br />
        d2.dateCreated as inputCreated,<br />
        d2.description,<br />
        d2.dateLastModified as inputLastModified,<br />
        d3.itemPos,<br />
        d3.TabID<br />
        FROM formControl d1, formInputControl d2, formInputControlMap d3<br />
        WHERE d3.fieldID = d2.ID<br />
        AND d1.ID = d3.formID<br />
        AND d1.ID in (1342)<br />
        order by d1.ID, d3.itemPos<br />
    &lt;/cfquery&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.spinonesolutions.com/2009/04/commonspot-developer-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CommonSpot Custom Field Validation</title>
		<link>http://www.spinonesolutions.com/2009/01/commonspot-custom-field-validation/</link>
		<comments>http://www.spinonesolutions.com/2009/01/commonspot-custom-field-validation/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 22:40:34 +0000</pubDate>
		<dc:creator>Will Wright</dc:creator>
				<category><![CDATA[Cold Fusion]]></category>
		<category><![CDATA[CommonSpot]]></category>

		<guid isPermaLink="false">http://www.spinonesolutions.com/?p=93</guid>
		<description><![CDATA[The Problem You&#8217;re making a form and the out-of-the-box field types just aren&#8217;t cutting it.  Most web developers are familiar with this scenario.  The biggest culprits are phone numbers, addresses, and credit cards. Let&#8217;s look at how you can quickly inject you&#8217;re own JavaScript validation into a CommonSpot form to handle any kind of validation [...]]]></description>
			<content:encoded><![CDATA[<h3>The Problem</h3>
<p>You&#8217;re making a form and the out-of-the-box field types just aren&#8217;t cutting it.  Most web developers are familiar with this scenario.  The biggest culprits are phone numbers, addresses, and credit cards.</p>
<p>Let&#8217;s look at how you can quickly inject you&#8217;re own JavaScript validation into a CommonSpot form to handle any kind of validation that you want.</p>
<h3>The Solution</h3>
<p>We&#8217;ll make use of custom field types in order to accomplish our goal.  First, we&#8217;ll make a custom render handler for our custom field type.  You may be thinking we should jump straight into the Site Admin, but that dialog is going to ask us to chose a custom render handler from a drop down list, so first we need to make the render handler so there&#8217;s something to choose from!</p>
<p>Fire up the FTP program of your choice, and navigate to the &#8220;customfields&#8221; folder in root.  I&#8217;ll be making a US Zip Code validator for this example so I&#8217;ll call my file &#8220;zip_render.cfm&#8221;.  If you want to register custom properties to your custom field type go ahead and create a &#8220;zip_props.cfm&#8221; in this folder now too.</p>
<p>Now that there&#8217;s something to choose; open Site Admin -&gt; Field Masks &amp; Custom Field Types -&gt; Register New Field Type.  You should see something like this:</p>
<p><img class="aligncenter size-medium wp-image-94" title="Add Custom Field Type Dialog" src="http://www.spinonesolutions.com/wp-content/uploads/2009/01/customfieldtype-483x600.jpg" alt="Add Custom Field Type Dialog" width="483" height="600" /></p>
<p>Type: The type of the field you&#8217;re creating.  It&#8217;s also what is displayed when choseing custom fields from the list.  I&#8217;ll call mine &#8220;Zip&#8221;.</p>
<p>Description: A human friendly description.  I&#8217;ll use &#8220;A valid US Zip code&#8221; for now. It can be a good idea to put what will and won&#8217;t match in here if you have the energy.</p>
<p>Property Module: Choose &#8220;zip_props.cfm&#8221; (whatever you called your file) if you made a Property Module or choose from the list of Standard Property Modules.  &#8220;Text&#8221; will work fine for me.</p>
<p>Render Module: Choose &#8220;zip_render.cfm&#8221; (whatever you called your file) from the list of Custom Render Modules.</p>
<p>Hit OK!</p>
<p>Now when you go to create/edit your form you&#8217;ll have a new field type available:</p>
<p><img class="aligncenter size-full wp-image-95" title="Edit Form Field - New custom field selected" src="http://www.spinonesolutions.com/wp-content/uploads/2009/01/editformfield.jpg" alt="Edit Form Field - New custom field selected" width="540" height="559" /></p>
<p>Now all we have to do is add the custom validation. Here&#8217;s my custom render handler (zip_render.cfm):</p>
<pre name="code" class="html">&lt;cfscript&gt;
	// the fields current value
	currentValue = attributes.currentValues[fqFieldName];
	// the param structure which will hold all of the fields from the props dialog
	xparams = parameters[fieldQuery.inputID];

	request.youproject.utils.loadJQueryHeaders();
&lt;/cfscript&gt;

&lt;cfoutput&gt;
	&lt;script Language="JavaScript"  type="text/javascript"&gt;
		// javascript validation to make sure they have text to be converted
		#fqFieldName#=new Object();
		#fqFieldName#.id='#fqFieldName#';
		#fqFieldName#.tid=#rendertabindex#;
		#fqFieldName#.msg="Please enter a valid zip code.";
		#fqFieldName#.validator="#fqFieldName#_validater()";
		// push on to validation array
		&lt;cfif xparams["REQ"]&gt;
			vobjects_#attributes.formname#.push(#fqFieldName#);
			$(document).ready(function(){
				$("###fqFieldName#_label").wrap("<strong></strong>");
			});
		&lt;/cfif&gt;

		function #fqFieldName#_validater() {
			regex = new RegExp("(^\\d{5}$)|(^\d{5}-\\d{4}$)");
			return regex.test($("###fqFieldName#").val());
		}
	&lt;/script&gt;
	&lt;tr&gt;
		&lt;td nowrap="nowrap" align="left" width="25%" valign="baseline"&gt;
			&lt;font face="Verdana,Arial" color="##000000" size="2">
                        &lt;label for="#fqFieldName#">#xparams["LABEL"]#:&lt;/label>
                &lt;/font>
		&lt;/td&gt;
		&lt;td align="left" width="75%" valign="baseline"&gt;
			&lt;input type="text" id="#fqFieldName#" name="#fqFieldName#" value="#currentValue#"&gt;
		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/cfoutput&gt;</pre>
<p>Not too complicated but, let&#8217;s go over it real quick so you can expand and adapt this simple case to suit your needs.</p>
<p>&#8220;fqFieldName&#8221; is holding the CommonSpot generated name of your form field.  If you don&#8217;t include an input field for it, it <strong>won&#8217;t</strong> get saved when the user hits submit.</p>
<p>The JavaScript object of the same name (fqFieldName) is holding the specifics for our valdiation.  There&#8217;s the message to display on fail (msg) and the function to call on validation (validator).</p>
<p>I&#8217;ve wrapped the last bit in a conditional so that my custom validation is only added to the form&#8217;s validation array if I mark the field as required in the element.</p>
<p>The HTML for the display for the form field is left to you, the developer.</p>
<p>As always, Questions and Comments are welcome!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spinonesolutions.com/2009/01/commonspot-custom-field-validation/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

