<?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>jensbits.com &#187; Work</title>
	<atom:link href="http://www.jensbits.com/category/work/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jensbits.com</link>
	<description></description>
	<lastBuildDate>Wed, 21 Jul 2010 03:44:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>CreateUserWizard Set Email as Username VB.NET 3.5</title>
		<link>http://www.jensbits.com/2010/03/05/createuserwizard-set-email-as-username-vb-net-3-5/</link>
		<comments>http://www.jensbits.com/2010/03/05/createuserwizard-set-email-as-username-vb-net-3-5/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 14:00:57 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=625</guid>
		<description><![CDATA[Commonly, a login username is the individual&#8217;s email address. If you have used the CreateUserWizard in ASP.NET 3.5, you know that the username field and the email field are separate fields. Username is required by the wizard and email is not. If you want to populate the email field in the database with the username [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Commonly, a login username is the individual&#8217;s email address. If you have used the CreateUserWizard in ASP.NET 3.5, you know that the username field and the email field are separate fields. Username is required by the wizard and email is not. If you want to populate the email field in the database with the username field, it is not obvious on the surface how to do it. Fortunately, it&#8217;s just some minor mods to the web.config and the aspx page.</p>
<h2>web.config</h2>
<p>In the web.config file, you will add requiresUniqueEmail=&#8221;false&#8221; to the membership provders add entry. Below is a stripped down example.</p>
<pre class="brush: xml;">
 &lt;membership defaultProvider=&quot;MyMembership&quot;&gt;
      &lt;providers&gt;
        &lt;add name=&quot;MyMembership&quot; type=&quot;System.Web.Security.SqlMembershipProvider&quot; connectionStringName=&quot;MyConnectionString&quot; requiresUniqueEmail=&quot;false&quot; /&gt;
        &lt;/providers&gt;
 &lt;/membership&gt;
</pre>
<h2>aspx page</h2>
<p>On the aspx page itself, you will add RequireEmail=&#8221;false&#8221; so the email textbox is not mandatory and a call to a function in the OnCreatedUser event to the CreateUserWizard. Also, some validation is added to the username field to ensure that it is in a valid email format.</p>
<pre class="brush: vb;">
&lt;asp:CreateUserWizard ID=&quot;CreateUserWizard1&quot; OnCreatedUser=&quot;CreateUserWizard1_CreatedUser&quot; RequireEmail=&quot;false&quot; Runat=&quot;server&quot;&gt;

&lt;asp:TextBox ID=&quot;UserName&quot; Width=&quot;200&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt;

&lt;asp:RequiredFieldValidator ID=&quot;UserNameRequired&quot; runat=&quot;server&quot; ControlToValidate=&quot;UserName&quot; ErrorMessage=&quot;E-mail is required.&quot;ValidationGroup=&quot;CreateUserWizard1&quot; /&gt;

&lt;asp:RegularExpressionValidator ID=&quot;regEmail&quot; ControlToValidate=&quot;UserName&quot; Text=&quot;Invalid e-mail&quot; ValidationExpression=&quot;\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*&quot; Runat=&quot;server&quot; /&gt;
</pre>
<p>The function fires right after the user is created and updates the email field with the username.</p>
<pre class="brush: vb;">
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs)
        Dim userNameTextBox As TextBox = CType(CreateUserWizardStep1.ContentTemplateContainer.FindControl(&quot;UserName&quot;), TextBox)
        Dim user As MembershipUser = Membership.GetUser(userNameTextBox.Text)

        user.Email = user.UserName
        Membership.UpdateUser(user)
    End Sub
</pre>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2010/03/05/createuserwizard-set-email-as-username-vb-net-3-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Passed the ColdFusion 8 Certification Exam</title>
		<link>http://www.jensbits.com/2010/01/05/passed-the-coldfusion-8-certification-exam/</link>
		<comments>http://www.jensbits.com/2010/01/05/passed-the-coldfusion-8-certification-exam/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 19:10:40 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=529</guid>
		<description><![CDATA[Passed the ColdFusion 8 Certification Exam today. Scored a 95 and could not have done it without CF8 Exam Buster. I have heard all the debate on whether or not to take the CF exam and I think most arguments against taking it are rubbish. The real benefit of taking any exam is the fact [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Passed the ColdFusion 8 Certification Exam today. Scored a 95 and could not have done it without <a href="http://www.centrasoft.com/products.cfm">CF8 Exam Buster</a>. </p>
<p><img   title="ColdFusion 8 Adobe Certified Expert - Advanced" alt="ColdFusion 8 Adobe Certified Expert - Advanced" src="/images/cfcert.gif" /></p>
<p>I have heard all the debate on whether or not to take the CF exam and I think most arguments against taking it are rubbish.</p>
<p>The real benefit of taking any exam is the fact that you get exposed to parts of the language that you never knew existed. Just studying for the exam helped me find tags, attributes, and functions I wouldn&#8217;t even have thought to look for. And, if you are a freelancer, it can only help to have this credential.</p>
<p>So, if you can pony up the $150 for the test and the $40 for Exam Buster, there is no reason why you shouldn&#8217;t take the exam. Just go through the Exam Buster tests until you consistently score in the 90&#8242;s and you are a lock to pass.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2010/01/05/passed-the-coldfusion-8-certification-exam/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Modal Confirmation Dialog on Form Submit: Javascript, jQuery UI, and Thickbox Varieties</title>
		<link>http://www.jensbits.com/2009/08/10/modal-confirmation-dialog-on-form-submit-javascript-jquery-ui-and-thickbox-varieties/</link>
		<comments>http://www.jensbits.com/2009/08/10/modal-confirmation-dialog-on-form-submit-javascript-jquery-ui-and-thickbox-varieties/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 13:15:15 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=336</guid>
		<description><![CDATA[jQuery files updated June 23, 2010 If you liked this post, you might also like the jQuery.ajax and jQuery.post Form Submit Examples with PHP post. I wanted to make a nice modal dialog box that would confirm submission of a form. And, specifically, it had to ask if their e-mail address was correct that they [...]


Related posts:<ol><li><a href='http://www.jensbits.com/2009/10/23/jquery-ajax-and-jquery-post-form-submit-examples-with-coldfusion/' rel='bookmark' title='Permanent Link: jQuery.ajax and jQuery.post Form Submit Examples with ColdFusion'>jQuery.ajax and jQuery.post Form Submit Examples with ColdFusion</a></li>
<li><a href='http://www.jensbits.com/2009/10/04/jquery-ajax-and-jquery-post-form-submit-examples-with-php/' rel='bookmark' title='Permanent Link: jQuery.ajax and jQuery.post Form Submit Examples with PHP'>jQuery.ajax and jQuery.post Form Submit Examples with PHP</a></li>
<li><a href='http://www.jensbits.com/2010/06/16/jquery-modal-dialog-close-on-overlay-click/' rel='bookmark' title='Permanent Link: jQuery Modal Dialog Close on Overlay Click'>jQuery Modal Dialog Close on Overlay Click</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><strong>jQuery files updated June 23, 2010</strong></p>
<blockquote><p>If you liked this post, you might also like the <a href="/2009/10/04/jquery-ajax-and-jquery-post-form-submit-examples-with-php/">jQuery.ajax and jQuery.post Form Submit Examples with PHP</a> post.</p></blockquote>
<p>I wanted to make a nice modal dialog box that would confirm submission of a form. And, specifically, it had to ask if their e-mail address was correct that they listed on the form. Typos, particularly transposed letters, cause a number of undeliverable e-mails. Making matters worse, sometimes by the time they get to the &#8216;Submit&#8217; button, the all important e-mail field is no longer in view. Yes, despite the web developer&#8217;s best efforts, people still manage to type in their own e-mail incorrectly. I&#8217;ve done it. We&#8217;re all human.</p>
<p>I already knew about the javascript 1.0 method of &#8216;return confirm&#8217; but I wanted more control over the look and feel. As an added requirement, I wanted to use Thickbox since I already had that loaded into the app. I don&#8217;t like throwing in a bunch of js files for every little nuance. If I can use what I already have, it makes the app much leaner.</p>
<p>So, I Googled it. I only found partial solutions. I wanted to go all the way and have the modal box pop up whether the user hit &#8216;Submit&#8217; or whether they hit enter on the keyboard in as many browsers as possible (hint: IE). Maybe I didn&#8217;t look hard enough, but I ended up creating the solution on my own.</p>
<p>Here are three examples (including <a href="http://jensbits.com/demos/forms/index.php">a complete demo</a>) of a form submission confirmation dialog. One each for just javascript, the jQuery UI dialog box, and Thickbox.</p>
<h2>Javascript 1.0</h2>
<p>For pure javascript it&#8217;s painfully straightforward:</p>
<pre class="brush: xml;">
&lt;form id=&quot;testconfirmJS&quot; name=&quot;testconfirmJS&quot; method=&quot;post&quot; onsubmit=&quot;return confirm('You entered your e-mail address as:\n\n' + document.getElementById('emailJS').value + '\n\nSelect OK if correct or Cancel to edit.')&quot;&gt;&gt;
&lt;fieldset&gt;
&lt;legend&gt;Javacript Return Confirm&lt;/legend&gt;
&lt;p&gt;&lt;label for=&quot;email&quot;&gt;E-mail:&lt;/label&gt;&lt;br /&gt;
&lt;input id=&quot;emailJS&quot; type=&quot;text&quot; name=&quot;emailJS&quot; value=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;&lt;/p&gt;
&lt;/fieldset&gt;
&lt;/form&gt;
</pre>
<p>And you get something that looks like this:<br />
<img src="http://jensbits.com/images/js-JS-FormSubmit.gif" alt="javascript confirm box" /></p>
<p>Low overhead, not too much strain on the brain but pretty plain vanilla. And boring. Let&#8217;s do something a little fancier.</p>
<h2>jQuery UI</h2>
<p>The <a href="http://jqueryui.com/">jQuery UI library</a> is awesome. Loads of flexibility and customization available and they hand you everything you need. For this solution we have to load in an additional stylesheet (you can <a href="http://jqueryui.com/themeroller/">download a custom ready-made css</a>), the jQuery base js, and the jQuery UI js. The jQuery UI site allows you to customize its js file to include only the parts you will use.</p>
<pre class="brush: xml;">
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/blitzer/jquery-ui-1.8.2.custom.css&quot;&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery-1.4.2.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery-ui-1.8.2.custom.min.js&quot;&gt;&lt;/script&gt;
</pre>
<p>The form is untouched for this approach, but we do have to add some js to the document itself and an additional div element that will hold the contents of our modal box.</p>
<p>Here the we set some parameters for the dialog box including what the buttons should say and do. Then a little jQuery is added so that the e-mail is displayed in the box and the box opens on submit allowing the user to hit the &#8216;Submit&#8217; button or the enter key.</p>
<pre class="brush: jscript;">
        $(function(){
                // jQuery UI Dialog    

                $('#dialog').dialog({
                    autoOpen: false,
                    width: 400,
                    modal: true,
                    resizable: false,
                    buttons: {
                        &quot;Submit Form&quot;: function() {
                            document.testconfirmJQ.submit();
                        },
                        &quot;Cancel&quot;: function() {
                            $(this).dialog(&quot;close&quot;);
                        }
                    }
                });

                $('form#testconfirmJQ').submit(function(){
                    $(&quot;p#dialog-email&quot;).html($(&quot;input#emailJQ&quot;).val());
                    $('#dialog').dialog('open');
                    return false;
                });
        });
</pre>
<p>The form is pretty clean and the div containing the text for the dialog box can be placed anywhere on the page.</p>
<pre class="brush: xml;">

&lt;form id=&quot;testconfirmJQ&quot; name=&quot;testconfirmJQ&quot; method=&quot;post&quot;&gt;
&lt;fieldset&gt;
&lt;legend&gt;jQuery UI Modal Submit&lt;/legend&gt;
&lt;p&gt;&lt;label for=&quot;email&quot;&gt;E-mail:&lt;/label&gt;&lt;br /&gt;
&lt;input id=&quot;emailJQ&quot; type=&quot;text&quot; name=&quot;emailJQ&quot; value=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;&lt;/p&gt;
&lt;/fieldset&gt;
&lt;/form&gt;

&lt;div id=&quot;dialog&quot; title=&quot;Verify Form jQuery UI Style&quot;&gt;&lt;p&gt;&lt;span class=&quot;ui-icon ui-icon-alert&quot; style=&quot;float:left; margin:0 7px 0 0;&quot;&gt;&lt;/span&gt; You entered your e-mail address as:&lt;/p&gt;&lt;p id=&quot;dialog-email&quot;&gt;&lt;/p&gt;&lt;p&gt;
If this is correct, click Submit Form.&lt;/p&gt;&lt;p&gt;To edit, click Cancel.&lt;p&gt;&lt;/div&gt;
</pre>
<p>Using this method you get a much prettier result:<br />
<img src="http://jensbits.com/images/js-JQ-UI-FormSubmit.gif" alt="jQuery dialog box" /></p>
<h2>Thickbox method</h2>
<p>The <a href="http://jquery.com/demo/thickbox/">ever helpful and massively adaptable Thickbox</a> was easily coded to do this as well. Thickbox also requires its own stylesheet and js along with the base jQuery file. Many apps have this already loaded since Thickbox is so wildly popular.</p>
<pre class="brush: xml;">
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/thickbox.css&quot;&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/thickbox-compressed.js&quot;&gt;&lt;/script&gt;
</pre>
<p>As with the jQuery UI method, we add some js to the document to put in the e-mail from the form, open the Thickbox, and instruct the buttons on what actions to take when clicked.</p>
<pre class="brush: jscript;">
        $(function(){
                //Thickbox

                $('form#testconfirmTB').submit(function(){
                    $(&quot;p#TB-email&quot;).html($(&quot;input#emailTB&quot;).val());
                    tb_show('Verify Form Thickbox Style','TB_inline?height=155&amp;amp;width=300&amp;amp;inlineId=TBcontent');
                    return false;
                });

                $('input#TBcancel').click(function(){
                    tb_remove();
                });

                $('input#TBsubmit').click(function(){
                    document.testconfirmTB.submit();
                });
        });
</pre>
<p>The form is also clean for this method and a div is added for the Thickbox content.</p>
<pre class="brush: xml;">
&lt;form id=&quot;testconfirmTB&quot; name=&quot;testconfirmTB&quot; method=&quot;post&quot;&gt;
&lt;fieldset&gt;
&lt;legend&gt;Thickbox Modal Submit&lt;/legend&gt;
&lt;p&gt;&lt;label for=&quot;email&quot;&gt;E-mail:&lt;/label&gt;&lt;br /&gt;
&lt;input id=&quot;emailTB&quot; type=&quot;text&quot; name=&quot;emailTB&quot; value=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;&lt;/p&gt;

&lt;/fieldset&gt;
&lt;/form&gt;

&lt;div id=&quot;TBcontent&quot; style=&quot;display: none;&quot;&gt;&lt;p&gt;You entered your e-mail address as:&lt;/p&gt;&lt;p id=&quot;TB-email&quot;&gt;&lt;/p&gt;&lt;p&gt;
If this is correct, click Submit Form.&lt;/p&gt;&lt;p&gt;To edit, click Cancel.&lt;p&gt;
&lt;input type=&quot;submit&quot; id=&quot;TBcancel&quot; value=&quot;Cancel&quot; /&gt;
&lt;input type=&quot;submit&quot; id=&quot;TBsubmit&quot; value=&quot;Submit Form&quot; /&gt;
&lt;/div&gt;
</pre>
<p>The Thickbox, generically styled (the default styling actually), looks like this:<br />
<img src="http://jensbits.com/images/js-TB-FormSubmit.gif" alt="Thickbox modal confirm box" /></p>
<p>Three flavors for confirming on form submission. Enjoy.</p>
<h2>Recommended:</h2>
<div style="height:250px;">
<div style="float:left;margin-right: 25px">
<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=jensbits-20&#038;o=1&#038;p=8&#038;l=as1&#038;m=amazon&#038;f=ifr&#038;md=10FE9736YVPPT7A0FBG2&#038;asins=0596159773" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
<div style="float:left;margin-right: 25px">
<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=jensbits-20&#038;o=1&#038;p=8&#038;l=as1&#038;m=amazon&#038;f=ifr&#038;md=10FE9736YVPPT7A0FBG2&#038;asins=1935182323" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
<div style="float:left;margin-right: 25px">
<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=jensbits-20&#038;o=1&#038;p=8&#038;l=as1&#038;m=amazon&#038;f=ifr&#038;md=10FE9736YVPPT7A0FBG2&#038;asins=0980576857" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
<div style="float:left;margin-right: 25px">
<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=jensbits-20&#038;o=1&#038;p=8&#038;l=as1&#038;m=amazon&#038;f=ifr&#038;md=10FE9736YVPPT7A0FBG2&#038;asins=0321509021" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
</div>
<p id="demo"><a href="/demos/forms/index.php"><span>Demo</span></a></p>
<p id="download"><a href="/media/code/modal-confirm.zip"><span>Download zip of all files</span></a></p>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="Help pay hosting. All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->



<p>Related posts:<ol><li><a href='http://www.jensbits.com/2009/10/23/jquery-ajax-and-jquery-post-form-submit-examples-with-coldfusion/' rel='bookmark' title='Permanent Link: jQuery.ajax and jQuery.post Form Submit Examples with ColdFusion'>jQuery.ajax and jQuery.post Form Submit Examples with ColdFusion</a></li>
<li><a href='http://www.jensbits.com/2009/10/04/jquery-ajax-and-jquery-post-form-submit-examples-with-php/' rel='bookmark' title='Permanent Link: jQuery.ajax and jQuery.post Form Submit Examples with PHP'>jQuery.ajax and jQuery.post Form Submit Examples with PHP</a></li>
<li><a href='http://www.jensbits.com/2010/06/16/jquery-modal-dialog-close-on-overlay-click/' rel='bookmark' title='Permanent Link: jQuery Modal Dialog Close on Overlay Click'>jQuery Modal Dialog Close on Overlay Click</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2009/08/10/modal-confirmation-dialog-on-form-submit-javascript-jquery-ui-and-thickbox-varieties/feed/</wfw:commentRss>
		<slash:comments>75</slash:comments>
		</item>
		<item>
		<title>Using ColdFusion to Generate Multiple Word Documents (Batch Creation)</title>
		<link>http://www.jensbits.com/2009/07/08/using-coldfusion-to-generate-multiple-word-documents-batch-creation/</link>
		<comments>http://www.jensbits.com/2009/07/08/using-coldfusion-to-generate-multiple-word-documents-batch-creation/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 14:34:40 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Word]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=257</guid>
		<description><![CDATA[UPDATE: Now includes line returns. The example&#8217;s form has been modified with additional fields so adding line returns to the Word doc could be shown. The zip has all the new files. As a continuation (and request from Simon) to the Using ColdFusion to Generate a Custom Word Document post, here is an example of [...]


Related posts:<ol><li><a href='http://www.jensbits.com/2009/06/21/using-coldfusion-to-generate-a-word-document/' rel='bookmark' title='Permanent Link: Using ColdFusion to Generate a Custom Word Document'>Using ColdFusion to Generate a Custom Word Document</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE: Now includes line returns. The example&#8217;s form has been modified with additional fields so adding line returns to the Word doc could be shown. The zip has all the new files.</strong></p>
<p>As a continuation (and request from Simon) to the <a href="/2009/06/21/using-coldfusion-to-generate-a-word-document/">Using ColdFusion to Generate a Custom Word Document</a> post, here is an example of creating multiple Word documents in a batch-like manner.</p>
<p>Create the Word template as an RTF (.rtf) document with placeholders in the same manner as the <a href="/2009/06/21/using-coldfusion-to-generate-a-word-document/">previous post</a>. Collect the data or have it spit out from a database. </p>
<p>Here&#8217;s where the code changes for multiple file generation. The number of files to be created is looped over, a dynamic name is generated for the new file, the output of the Replace functions is written to the new file, and the file is renamed with a .doc extension.</p>
<p>Also, a cfloop was added for the studentname fields so a line return (\par) could be appended on.</p>
<pre class="brush: coldfusion;">
&lt;cfset pathToRTF =  GetDirectoryFromPath(GetCurrentTemplatePath()) &amp; &quot;homeworkpass.rtf&quot; /&gt;

&lt;cfloop from=&quot;1&quot; to=&quot;10&quot; index=&quot;i&quot;&gt;

    		&lt;cfset studentnames = &quot;&quot; /&gt;

                &lt;cfloop from=&quot;1&quot; to=&quot;3&quot; index=&quot;num&quot;&gt;
                	&lt;cfset studentnames = studentnames &amp; &quot; &quot; &amp; form[&quot;studentname&quot; &amp; num] &amp; &quot; \par &quot; /&gt;
                &lt;/cfloop&gt;

            &lt;cflock name=&quot;homeworkpass&quot; type=&quot;exclusive&quot; timeout=&quot;30&quot;&gt;

                &lt;cfif form.cfversion EQ &quot;pre8&quot;&gt;
                &lt;!--- CFMX7 or earlier ---&gt;
                    &lt;cffile action=&quot;read&quot; file=&quot;#pathToRTF#&quot; variable=&quot;rtf&quot;&gt;
                 &lt;cfelse&gt;
                &lt;!--- CF8 or later ---&gt;
                    &lt;cfset rtf = FileRead(pathToRTF) /&gt;
                &lt;/cfif&gt;

                &lt;cfset rtf = Replace(rtf,&quot;%expirydate%&quot;,form.expirydate) /&gt;
                &lt;cfset rtf = Replace(rtf,&quot;%points%&quot;,form.points) /&gt;
                &lt;cfset rtf = Replace(rtf,&quot;%studentname%&quot;,studentnames) /&gt;
                &lt;cfset rtf = Replace(rtf,&quot;%subject%&quot;,form.subject) /&gt;
                &lt;cfset rtf = Replace(rtf,&quot;%datereceived%&quot;,form.datereceived) /&gt;

            &lt;/cflock&gt;

            &lt;cfset rtfFile = GetDirectoryFromPath(GetCurrentTemplatePath()) &amp; &quot;classPasses/&quot; &amp; &quot;homeworkpass&quot; &amp; i &amp; &quot;.rtf&quot; /&gt;
            &lt;cfset docFile = GetDirectoryFromPath(GetCurrentTemplatePath()) &amp; &quot;classPasses/&quot; &amp; &quot;homeworkpass&quot; &amp; i &amp; &quot;.doc&quot; /&gt;

            &lt;cfif form.cfversion EQ &quot;pre8&quot;&gt;
                &lt;!--- CFMX7 or earlier ---&gt;
                    &lt;cffile action=&quot;write&quot; file=&quot;#rtfFile#&quot; output=&quot;#rtf#&quot; /&gt;
            &lt;cfelse&gt;
                &lt;!--- CF8 or later ---&gt;
                    &lt;cfset FileWrite(rtfFile,rtf) /&gt;
             &lt;/cfif&gt;

             &lt;cffile action=&quot;rename&quot; source=&quot;#rtfFile#&quot; destination=&quot;#docFile#&quot; /&gt;

         &lt;/cfloop&gt;
         &lt;p&gt;Passes Generated&lt;/p&gt;
         &lt;cfabort&gt;
</pre>
<p>This should get you pointed in the right direction for creating multiple Word documents. And, again, there is a choice of ColdFusion 8 or an earlier version just to show the new, simpler functions available in CF8.</p>
<p id="demo"><a href="http://cf-jensbits.com/demos/cfwordbatch/" onclick="_gaq.push(['_link', 'http://cf-jensbits.com/demos/cfwordbatch/']); return false;"><span>Demo</span></a></p>
<p id="download"><a href="/media/code/CFgenerateWordMultiFiles.zip"><span>Download Files (zip)</span></a></p>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="Help pay hosting. All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->



<p>Related posts:<ol><li><a href='http://www.jensbits.com/2009/06/21/using-coldfusion-to-generate-a-word-document/' rel='bookmark' title='Permanent Link: Using ColdFusion to Generate a Custom Word Document'>Using ColdFusion to Generate a Custom Word Document</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2009/07/08/using-coldfusion-to-generate-multiple-word-documents-batch-creation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Latest mag obsession &#8220;Practical Web Design&#8221; aka &#8220;.net&#8221;</title>
		<link>http://www.jensbits.com/2008/10/29/latest-mag-obsession-practical-web-design-aka-net/</link>
		<comments>http://www.jensbits.com/2008/10/29/latest-mag-obsession-practical-web-design-aka-net/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 22:18:34 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/2008/10/29/latest-mag-obsession-practical-web-design-aka-net/</guid>
		<description><![CDATA[I have to hand to the Brits; they are into web design and standardization like nobody&#8217;s business. Web design and development is a moving target. I have been to the expensive conferences and events. Loads of great and inspiring info. Problem is you need something that you can refer back to and use as a [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I have to hand to the Brits; they are into web design and standardization like nobody&#8217;s business. Web design and development is a moving target. I have been to the expensive conferences and events. Loads of great and inspiring info. Problem is you need something that you can refer back to and use as a resource. And, something that is here and now, tangible, tactile, and moving as fast as web evolution itself. I&#8217;m talking mags.<br />
<a href="http://www.netmag.co.uk/"><img class="photo-r" src="http://jensbits.com/images/netmag.gif" alt=".net mag" /></a><br />
I got my hands on a copy of the UK produced and published <a href="http://www.amazon.com/gp/product/B00007KZJ2?ie=UTF8&#038;tag=jensbits-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B00007KZJ2">&#8220;Practical Web Design&#8221; (known as &#8220;.net&#8221; in Great Britain)</a><img src="http://www.assoc-amazon.com/e/ir?t=jensbits-20&#038;l=as2&#038;o=1&#038;a=B00007KZJ2" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> magazine at Borders and have read every word twice. It&#8217;s like carrying around the enthusiasm and electricity of a conference in my pocket(book). This is what web designers need. A constant flow of practical and applicable information. It keeps you motivated and relevant. It doesn&#8217;t hurt that I have met many of the contributors and advisory panels members at the aforementioned conferences. They are picking the top and, IMHO, the most credible talent to fill the pages.</p>
<p>Now for the bad news. It&#8217;s expensive here in the US (over $130/yr) at the current exchange rate. I&#8217;ll keeping picking it up a copy at a time to spread out the pain, but I love it anyway.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2008/10/29/latest-mag-obsession-practical-web-design-aka-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
