<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>SharePoint Magazine &#187; forms</title>
	<atom:link href="http://sharepointmagazine.net/tag/forms/feed" rel="self" type="application/rss+xml" />
	<link>http://sharepointmagazine.net</link>
	<description>SharePoint Magazine is an online Magazine dedicated to the world of SharePoint</description>
	<lastBuildDate>Mon, 05 Jul 2010 09:14:11 +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>A tribute to the humble &#8220;leave form&#8221; &#8211; Part 7</title>
		<link>http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-7</link>
		<comments>http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-7#comments</comments>
		<pubDate>Tue, 10 Feb 2009 13:08:04 +0000</pubDate>
		<dc:creator>cleverworkarounds</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[bpm]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[infopath]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[services]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=1930</guid>
		<description><![CDATA[...it pains me greatly to have to inform you that this seventh edition of the series is one of those posts where you have to put on the brakes and explain some really boring conceptual stuff to proceed with the rest of the series. Yeah, I know - theory is boring and sucky and you just wanna get into the nuts and bolts of it all. But, as Homer often demonstrates, sometimes we have to defy our genetic programming and actually read the instructions...]]></description>
			<content:encoded><![CDATA[<p>Hi all</p>
<p>Welcome to edition 7 of this seemingly never-ending tribute to the humble annual leave (vacation) form. This is getting to be like the &#8220;Friday the 13th&#8221; series of movies &#8211; they never stop!</p>
<p>First up, I want to categorically state that, as a heterosexual Australian male, I have a few stereotypical personality traits . I enjoy beer, kung-fu movies, <a href="http://en.wikipedia.org/wiki/Burger_Rings" target="_blank">Burger Rings</a>, <a href="http://en.wikipedia.org/wiki/Vegemite" target="_blank">Vegemite</a> and <a href="http://en.wikipedia.org/wiki/Tim_tams" target="_blank">Tim-Tams</a>, love the cricket (especially playing India) and most importantly of all, I do not read instructions. Period. I think that ignoring the RTFM rule is a characteristic of all of humanity but Australians in particular seem to celebrate this trait as something endearing.</p>
<p>Therefore, it pains me greatly to have to inform you that this seventh edition of the series is one of those posts where you have to put on the brakes and explain some really boring conceptual stuff to proceed with the rest of the series. Yeah, I know &#8211; theory is boring and sucky and you just wanna get into the nuts and bolts of it all. But, as Homer demonstrates below, sometimes we have to defy our genetic programming and actually read the instructions. The alternative is a SharePoint solution equivalent to that of Homers BBQ.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image36.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb26.png" border="0" alt="image" width="372" height="278" /></a></p>
<p>This post will deal with some of the mechanics of form submission and form publishing.</p>
<h2>What has gone before&#8230;</h2>
<p>The first few posts in this series are starting to get hazy &#8211; it seems so long ago now. To sum it all up in a nutshell, we introduced the leave form as a means to introduce a lot of key SharePoint features in an easy to understand and relevant way. We set several requirements that we had to achieve.</p>
<li>Automatic identification of requestor</li>
<li>Reduce data entry</li>
<li>Validation of dates, specifically the automatic calculation of days absent (excluding weekends)</li>
<li>Mr Burns is not the only approver, we will need the workflow to route the leave approval to the right supervisor</li>
<li>We have a central leave calendar to updateAt the end of part 6 we were working on validation of dates. We added some validation rules to ensure that you could not return to work before you started your leave of absence. But at the end of that post, I showed how a published form did <strong>not </strong>obey our data validation rule, where the form was set to prohibit incorrect dates, yet I was able to click save and put the form straight into the document library. What the&#8230;?Why did this occur?<br />
<h2>Saving vs Submitting &#8211; form confusion</h2>
<p>Like everything else designed by nerdy engineers, InfoPath and Forms Services can be used in a few different ways. This offers flexibility of course, but has the disadvantage that if the flexibility is not well understood (i.e not reading the instructions <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ), it is easy to cause user confusion. Homer is a classic case of a person who, when faced with two choices, will always pick the wrong one.</p>
<p>You have to remember that InfoPath started out as a program installed onto your PC, along with other MSOffice applications. Thus, historically, an InfoPath form is just another type of document. In its simplest (and default) scenario, the form is very much like any other MSOffice document in that you create/open the form, edit it and then save it.</p>
<p>But hang on a second! Most of the time, the data collected in the form is part of a larger business process. Also most of the time, business process needs to do &#8220;stuff&#8221; with the information that the user has entered. In other words, the data usually doesn&#8217;t stay in the forms that users fill out.</p>
<p>So the InfoPath designers, wanting to please everybody, designed InfoPath in such a way that <strong>saving </strong>a form and <strong>submitting </strong>a form are two different things. Homer Simpson doesn&#8217;t care about this nor should he. He just wants to fill out the form so he can go back to dreaming about the land of chocolate.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image37.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb27.png" border="0" alt="image" width="240" height="186" /></a></p>
<p>Here is the key thing you need to know, though. Saving a form is, in effect, performed on the presumption that the form <strong>is still a work in progress</strong>. Saving the form should be thought about in the same way you would save a word document after performing some edits. Because the form is still a work in progress, data validation should <strong>not take place</strong>.</p>
<p>But at some point the form stops being a &#8216;document&#8217; and becomes&#8230;well&#8230; a form! It is complete and no more edits should be made. This is when you actually <strong>submit</strong> the form!</p>
<p>Submitting a form <strong>triggers the data validation rules</strong> that were set up in <a title="part 6" href="http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6">part 6</a>.</p>
<h2>Big deal&#8230;When does this get hard, Paul?</h2>
<p>Okay, so you may not think that there is really that much of a drama with the whole &#8220;save vs submit&#8221; thing. But when InfoPath is integrated with SharePoint via Forms Services, it can get complicated. You see, InfoPath allows you to create forms that submit their data to <strong>one or more locations</strong>. For example, the Springfield Nuclear Power Plant leave form could be set up so that when Homer submits his application, the data is sent to a database, and a copy of each completed form is also sent in an e-mail message to Waylon Smithers and Monty Burns.</p>
<p>For reference, here are the places that InfoPath can submit to;</p>
<ul>
<li>A Microsoft Access or Microsoft SQL Server database</li>
<li>A Web service</li>
<li>A server running Microsoft Windows SharePoint Services</li>
<li>In an e-mail message</li>
<li>An application on a Web server</li>
<li>A custom application that hosts InfoPath</li>
</ul>
<p>Now, given that this series of articles is about SharePoint, which option of the above list do you think we are interested in? You guessed it! The third option in the above list is SharePoint.</p>
<p>But here is the root cause of the confusion, when you <strong>publish</strong> an InfoPath form to SharePoint, all forms that you fill in end up being created in a document library. Back in part 4 of this series, we first published the form and as part of that process, created a form library called &#8220;Leave Forms&#8221;. Consider the screenshot below. We are about to create a new form in this library.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image59.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb57.png" border="0" alt="image" width="244" height="151" /></a></p>
<p>Below is a screenshot of the new form to fill out. Note the toolbar at the top with a &#8220;Save&#8221; and &#8220;Save As&#8221; options. If you then click &#8216;Save&#8221; on the form, it will prompt you to save into the above document library.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image43.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb32.png" border="0" alt="image" width="434" height="251" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image39.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb29.png" border="0" alt="image" width="317" height="210" /></a></p>
<p>Therefore, if you use the &#8220;Save&#8221; option, the &#8220;In-progress&#8221; copies of the form are stored in the document library and <strong>no data validation</strong> has taken place. You really have not submitted the form at all.</p>
<p>Does the end user realise this? Some might &#8211; but come on! This is Homer J Simpson we are talking about here!</p>
<p>So clearly we need to submit this form because in <a title="part 6" href="http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6">part 6</a> we added validation rules that need to be checked. But, what the&#8230;? &#8211; How the hell do I submit?</p>
<h2>Setting up form submission</h2>
<p><em>Real programmer disclaimer: Yes I know there are other ways of doing all of this, but remember &#8211; this series of posts is for beginners.</em></p>
<p>Okay, for now the theory bit is over, and now we get to play with InfoPath again. We are going to add the form submission capability to our existing form so that we can actually submit the form. The thing is, I am also going to *remove* the &#8220;Save&#8221; and &#8220;Save As&#8221; options from that toolbar, so that the only action you can make is to submit.</p>
<p>Why would I do this? Several reasons.</p>
<ul>
<li>It is a simple form and really, you either fill it in and submit or you don&#8217;t. There really isn&#8217;t that much of an imperative to save this form, prior to submitting it.</li>
<li>When you submit a form, and you are submitting to a SharePoint library, the submitted form is saved. Therefore, I don&#8217;t need a &#8220;work in progress&#8221; copy.</li>
<li>The Homer factor. If you supply a &#8220;Submit&#8221; and a &#8220;Save&#8221; button, you know full well that Homer will go and click the &#8220;Save&#8221; button, when he should be clicking &#8220;Submit&#8221;. As soon as the save dialog pops up, he won&#8217;t know what to do. At this point he will lose interest and fall asleep.</li>
</ul>
<h2>Hiding save buttons</h2>
<p>So, start InfoPath, open up the leave form in design mode, and choose &#8220;Form options&#8221; from the &#8220;Tools&#8221; menu.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image40.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb30.png" border="0" alt="image" width="212" height="178" /></a></p>
<p>From the list of options, choose &#8220;Open and Save&#8221; and <strong>uncheck</strong> the &#8220;Save and Save As&#8221; checkbox as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image42.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb31.png" border="0" alt="image" width="418" height="356" /></a></p>
<p>Click &#8220;OK&#8221; and republish this form to SharePoint using the steps described in part 4. Note the before and after screenshots below <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image43.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb32.png" border="0" alt="image" width="383" height="222" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image44.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb33.png" border="0" alt="image" width="317" height="220" /></a></p>
<p>Spot the difference? The &#8220;Save&#8221; and &#8220;Save As&#8221; buttons are missing, and with that I can confidently say that I have now made this form Homer proof because he can&#8217;t inadvertently click &#8220;Save&#8221; and think he has submitted the form. Of course, it is so Homer proof that he now has no way to submit the form, so now we have to enable the &#8220;Submit&#8221; button.</p>
<h2>Enabling the submit button</h2>
<p>Once again, open the leave form in design mode, and choose &#8220;Submit Options&#8221; from the &#8220;Tools&#8221; menu. InfoPath will dutifully display a fairly nondescript dialog box that, at first glance, seems rather simple. There is a checkbox that you need to tick to &#8220;enable form submission&#8221;. Sweet! How easy is that?</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image45.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb34.png" border="0" alt="image" width="210" height="168" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image47.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb35.png" border="0" alt="image" width="244" height="211" /></a></p>
<p>Upon checking that box, you now have to choose where you are going to send form data to. The default option is &#8220;Email&#8221;, but we want to send it to a SharePoint document library, as shown below. Choose SharePoint and then click OK.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image48.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb36.png" border="0" alt="image" width="244" height="139" /></a></p>
<p>Uh oh! Did I say this was going to be easy? Okay I lied <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image50.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb37.png" border="0" alt="image" width="527" height="82" /></a></p>
<p>So, what is this message telling us? &#8220;You must select a data connection for submitting to a SharePoint document library&#8221;. Hmmm&#8230;I hope that something about that message sounds vaguely familiar to you. That is because this is <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">not the first time</a> we have dealt with data connections.</p>
<h2>Data Connections revisited</h2>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb.png" border="0" alt="image" width="159" height="156" /></a></p>
<p>Way back in part 5, you earned your CCLFD certification by creating a data source that automatically identified Homer by talking to SharePoint web services. If you missed that post, then I suggest reading it, as it is a great example of utilising data connections to *receive* data into InfoPath.</p>
<p>In part 5, we set up a data connection to a webservice by following a wizard. To remind you of how it was done, I have copied the screenshots to this post.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image12.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb12.png" border="0" alt="image" width="226" height="208" /></a><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image13.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb13.png" border="0" alt="image" width="412" height="121" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/08/image14.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/08/image-thumb14.png" border="0" alt="image" width="244" height="162" /></a></p>
<p>Now, take a look at the second screenshot from the above three. It is asking you to create a connection to receive or submit data and at that time we were receiving data. Guess which one we are doing this time? <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>So, back to our &#8220;Submit Options&#8221; dialog box. We were not able to click &#8220;OK&#8221;, because we have not created a data connection to submit the data. Let&#8217;s now start this process by clicking the &#8220;Add&#8221; button. Given that you have already told SharePoint that you want to submit to a document library, InfoPath now wants to know the name of that document library and the name of the file that will be created by the submit.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image51.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb38.png" border="0" alt="image" width="331" height="286" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image52.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb39.png" border="0" alt="image" width="423" height="286" /></a></p>
<p>Now, given that the entire staff of the nuclear power plant will be filling out this form, we don&#8217;t want to simply call the submitted form &#8220;Form&#8221; as suggested by default. If we did that, we would end up with a document library containing a single file called &#8220;FORM&#8221; due to the fact that all previous &#8220;FORM&#8221; files would have been overwritten and replaced by the current &#8220;FORM&#8221;.</p>
<p>Luckily the InfoPath team anticipated this and the filename can be dynamically generated using functions. (We looked at functions early in <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">part 5</a>).</p>
<p>First up though, I will specify the document library to submit completed forms to. It will be in the same document library that we was created when we first published the leave form in part 4,the imaginatively titled &#8220;Leave Forms&#8221;. Below is the library as it is inside the radiactivenet site. Note the URL is exactly what I entered into the &#8220;Document Library&#8221; field.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image53.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb40.png" border="0" alt="image" width="462" height="250" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image54.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb41.png" border="0" alt="image" width="570" height="219" /></a></p>
<h2>A unique filename</h2>
<p>The final step for submission is to create an auto-generated filename that is unique. Although the principle is dead simple, this bit is actually tricky when you do it for the first time.</p>
<p>The file naming convention to be used will be as follows:</p>
<p>&#8220;Leave Form &#8211; &#8221; + [EmployeeName field] + &#8221; &#8211; &#8220;, [LeaveType field] + &#8221; &#8211; &#8221; + [todays date]</p>
<p>Here are some examples of this convention in action with various staff.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image56.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb42.png" border="0" alt="image" width="224" height="178" /></a></p>
<ul>
<li>&#8220;Leave Form &#8211; Homer Simpson &#8211; Sick &#8211; 2007-09-18&#8243;</li>
<li>&#8220;Leave Form &#8211; Lenny Leonard &#8211; Annual &#8211; 2008-11-22&#8243;</li>
<li>&#8220;Leave Form &#8211; Carl Carlson &#8211; Bereavement &#8211; 2008-12-25&#8243;</li>
</ul>
<p>So, how do we achieve this? Let&#8217;s get back to the screen where we are prompted to add a file name for a submitted form.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image54.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb41.png" border="0" alt="image" width="570" height="219" /></a></p>
<p>Click the &#8220;Fx&#8221; button to the right of the &#8220;File name&#8221; textbox and you will be presented with the (far too small to be user friendly) &#8220;Insert Formula&#8221; dialog box. We are going to create a formula that constructs the desired file name.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image57.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb43.png" border="0" alt="image" width="244" height="159" /></a></p>
<p>The first thing to note is that we will be using a combination of fixed text, the data entered on the form and built in InfoPath functions. To join all these together in the manner we want is referred to as <a href="http://en.wikipedia.org/wiki/Concatenation" target="_blank">concatenation</a>. Why do people call it concatenation? I have no idea but it&#8217;s obvious that an engineer thought up that name! <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p>We start by inserting the concatenation function called &#8220;concat&#8221;. Click &#8220;Insert Function&#8221; and in the leftmost window choose the &#8220;Text&#8221; category. The function called &#8220;concat&#8221; should be the first one listed. Select it and click &#8220;OK&#8217; and you will see that a partially completed formula has been created.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image58.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb44.png" border="0" alt="image" width="282" height="193" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image59.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb45.png" border="0" alt="image" width="295" height="193" /></a></p>
<p>The first part of our file name is the text &#8220;Leave Form &#8211; &#8220;. So <strong>single click</strong> the first occurrence of the &#8220;double click to insert field&#8221; hyperlink and it will be highlighted. From here, simply type in the string &#8220;Leave Form &#8211; &#8221; (including the double quotes).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image60.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb46.png" border="0" alt="image" width="284" height="184" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image62.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb47.png" border="0" alt="image" width="283" height="184" /></a></p>
<p>The next part of the file name is the name of the employee. We already have this, because in part 5 we set up a data connection to automagically grab first name and surname and store it in the textbox called &#8220;EmployeeName&#8221;.</p>
<p><strong>Single click</strong> the next occurrence of the &#8220;double click to insert field&#8221; hyperlink and it will be highlighted. From here, click &#8220;Insert Field or Group&#8221; and choose &#8220;EmployeeName&#8221; from the list of fields.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image63.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb48.png" border="0" alt="image" width="286" height="185" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image64.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb49.png" border="0" alt="image" width="215" height="244" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image65.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb50.png" border="0" alt="image" width="284" height="184" /></a></p>
<p>Okay, so we have the &#8220;Leave Form &#8211; Homer Simpson&#8221; part done. Next we want a hyphen &#8221; &#8211; &#8221; and then the LeaveType field. By now you should be getting familiar editing the formula in the dialog box. Rather than bore you with even more screenshots, I&#8217;ll talk through the next 2 steps.</p>
<ul>
<li>Single click the next &#8220;double click to insert field&#8221; link.</li>
<li>Type in (note the leading and trailing space) &#8221; &#8211; &#8220;</li>
<li>Type in a comma (minus quotes) &#8220;,&#8221;</li>
<li>Click &#8220;Insert Field or Group&#8221; button</li>
<li>Choose the &#8220;LeaveType&#8221; field and click OK.</li>
</ul>
<p>If all has gone to the script, then you will see this in for formula box.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image66.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb51.png" border="0" alt="image" width="290" height="189" /></a></p>
<p><em>Note that you can use the mouse to place the cursor anywhere in the Formula textbox and modify what is there.</em></p>
<p>Finally, we need another hyphen and to insert another function. This time the function is called &#8220;time&#8221; and it returns the current date in a short locale based format.</p>
<ul>
<li>Referring to the above screenshot, place your cursor between the last letter of the underlined LeaveType (which is &#8220;e&#8221; ) and the closing bracket.</li>
<li>Type in (including the quotes and note the leading and trailing space) &#8221; &#8211; &#8220;</li>
<li>Type in a comma (minus quotes) &#8220;,&#8221;</li>
<li>Click &#8220;Insert Function&#8221; button</li>
<li>Choose &#8220;Date and Time&#8221; from the Categories List in the &#8220;Insert Function&#8221; dialog box</li>
<li>Choose &#8220;today&#8221; from the list of functions and click &#8220;OK&#8221;</li>
</ul>
<p>We are done! The final formula looks like this. Click &#8220;OK&#8221; and you now should be back at the data connection wizard (the second screenshot below).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image67.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb52.png" border="0" alt="image" width="299" height="192" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image69.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb53.png" border="0" alt="image" width="593" height="240" /></a></p>
<p>Click &#8220;NEXT&#8221; on the wizard, and we are prompted to give this data connection a name. Since this data connection has been created to submit leave forms to a document library called &#8220;Leave Forms&#8221;, I figured that a good name would be &#8220;Submit to Leave Form Library&#8221;. Click &#8220;Finish&#8221; and you are done!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image70.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb54.png" border="0" alt="image" width="597" height="404" /></a></p>
<p>To recap on what we have completed in this section, each time a form is submitted, its filename will be automatically specified and the end-user does not have to worry about it.</p>
<p>All rightie, then! Let&#8217;s republish this form to SharePoint and take a look at the effect.</p>
<h2>Testing it out</h2>
<p>Assuming everything worked, the effect of what we have done is immediately noticeable. We now have a &#8220;Submit&#8221; button on the form where the &#8220;Save&#8221; and &#8220;Save As&#8221; used to be. Sweet!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image71.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb55.png" border="0" alt="image" width="550" height="316" /></a></p>
<p>So let&#8217;s test the data validation rules that we created in part 6. If you recall, this form should not be submitted if the return date is before the start date. For that to really happen you would have to be Dr Who and use the Tardis to arrive before your departure&#8230;</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image72.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb56.png" border="0" alt="image" width="184" height="212" /></a></p>
<p>Below is the form with deliberately incorrect data (click to enlarge).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image73.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb57.png" border="0" alt="image" width="244" height="168" /></a></p>
<p>If I now click the newly visible &#8220;Submit&#8221; button, what happens? Ecccccxcelent! It refuses to submit the form.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image74.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb58.png" border="0" alt="image" width="600" height="88" /></a></p>
<p>I don&#8217;t know about you, but this is one of those error messages that some people simply will not read. Homer will no doubt call technical support but the point is, crap data has not gotten past the form in the first place.</p>
<p>Now, when we correct the fault and resubmit the form, it accepts!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image75.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb59.png" border="0" alt="image" width="447" height="200" /></a></p>
<p>Click &#8220;Close&#8221; and we now see the newly submitted form in the document library, saved with our file naming convention! Woohoo!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/11/image76.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/11/image-thumb60.png" border="0" alt="image" width="685" height="160" /></a></p>
<h2>Conclusion (Are we done yet?)</h2>
<p>We now have achieved the goal of ensuring that our form is validated before being submitted. From a skills point of view, you now have created data connections to both send and receive data and you have integrated your form with web services, as well as some nice data validation logic.</p>
<p>Waylon Smithers is still pleased with progress thus far, and Homer hasn&#8217;t managed to completely derail things just yet.</p>
<p>But unfortunately for all of us, there is still much work to do. The next post will spend some time pimping up this whole validation and submission process, illustrating a pitfall or two along the way.</p>
<p>Thanks for reading</p>
<p>Paul Culmsee</p>
<p><a href="http://www.sevensigma.com.au">www.sevensigma.com.au</a></p>
<p><a href="http://www.cleverworkarounds.com">www.cleverworkarounds.com</a></li>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-7/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>A tribute to the humble leave form &#8211; part 6</title>
		<link>http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6</link>
		<comments>http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6#comments</comments>
		<pubDate>Fri, 28 Nov 2008 09:29:13 +0000</pubDate>
		<dc:creator>cleverworkarounds</dc:creator>
				<category><![CDATA[Help]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[infopath]]></category>
		<category><![CDATA[leave]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=1498</guid>
		<description><![CDATA[This time around, let's take care of the "reduce data entry" requirement, and leverage some of InfoPath's useful features to make our form smarter.]]></description>
			<content:encoded><![CDATA[<p>Hi again</p>
<p>When I started this series of articles, I knew it would be quite a few parts and ambitious in its way. But after reading some of the other great articles on SharePoint Magazine, such as Bjørn Furuknap&#8217;s first article on <a href="http://sharepointmagazine.net/technical/development/customizing-the-user-experience-of-sharepoint-overview-of-the-default-sharepoint-interface-from-a-technical-point-of-view-part-1-of-6" target="_blank">customising the user experience</a>, I&#8217;m now feeling like I picked the easiest topic of all!</p>
<p>Seriously, Bjørn, part 1 of your series is the closest experience I can imagine to any man giving birth! I bet you feel relieved getting that one out of your system!</p>
<p>So, do I feel guilty that my subject matter is easier? Am I suffering nerdiness envy?</p>
<p>Hell, no! I&#8217;ll stick to my fantasy world of user acceptance testing with Homer Simpson any day!</p>
<h2>Previously&#8230;</h2>
<p><em>Given that there are big time gaps in getting these articles out, I&#8217;d just like to reiterate that this series is pitched at a very wide audience, so hard-core nerds will probably find it waffly and frustrating. But then again, most regular people find hard core nerds waffly and frustrating <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</em></p>
<p>I have been writing this series from the point of view of a frustrated implementation developer/engineer who has to deal with a clueless business development manager and a difficult customer. This, of course, is completely unfamiliar territory for all implementation developer/engineers because none of you reading this would have ever experienced such a situation, right? &#8230; hehe <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image1.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb1.png" border="0" alt="image" width="204" height="237" /></a></p>
<p>Part one of this series introduced some background and provided the requirements for the leave application/approval process for the Springfield nuclear power plant. Those requirements were:</p>
<li>Automatic identification of requestor</li>
<li>Reduce data entry</li>
<li>Validation of dates, specifically the automatic calculation of days absent (excluding weekends)</li>
<li>Mr Burns is not the only approver, we will need the workflow to route the leave approval to the appropriate supervisor</li>
<li>We have a central leave calendar to update</li>
<p>Parts two to four were really the &#8220;slick presales demo&#8221; parts of this series where the world is promised to the client and, hence, expectations were completely off the planet. Thus, we started out nice and easy in part <a href="http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-2" target="_blank">two</a> and <a href="http://sharepointmagazine.net/technical/administration/a-tribute-to-the-humble-leave-form-part-3" target="_blank">three</a>, where we introduced InfoPath 2007 and went through the exercise of importing the existing Springfield MSWord based form. We then added some data entry controls and tidied up the formatting. In <a href="http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4" target="_blank">part four</a>, we published this form to SharePoint itself.</p>
<p>All in all, the first four articles covered some pretty straightforward stuff. Now, however, the salesman has moved on and our intrepid engineer is starting to get into the pointy end of things. In <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">part five</a> we delved into the scary world of web services and InfoPath data connections so satisfy the requirement of automatic identification of the requestor. That was a bit of a jump, wasn&#8217;t it?</p>
<p>This time around, let&#8217;s take care of the &#8220;reduce data entry&#8221; requirement, and leverage some of InfoPath&#8217;s useful features to make our form smarter. For those who found <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">article 5</a> a bit heavy, this one is actually quite a bit easier (but it&#8217;s just a brief lull before we get to coding!). At the end of part 5 I said I&#8217;d deal with how to automagically handle the employee number &#8211; but I have decided to take care of that a little later.</p>
<h2>Preventing a rift in the space-time continuum</h2>
<p><em>Yeah, I know I was using the Simpsons theme for this series, but today I am dropping in a dash of Heroes.</em></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image2.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb2.png" border="0" alt="image" width="141" height="175" align="right" /></a>First up, we need to add some logic to the form so that it doesn&#8217;t submit crap (that&#8217;s the technical term for &#8220;invalid&#8221;) information. For example, we want to make sure that you cannot return to work on a date *before* you leave &#8211; unless you&#8217;re <a href="http://en.wikipedia.org/wiki/Hiro_Nakamura" target="_blank">Hiro Nakamura</a>, of course.</p>
<p>Generally, for the rest of us who cannot bend time, you do actually come back to work at some point *after* you leave, so let&#8217;s make the necessary changes to ensure that our form does not destroy the world in some space-time vortex.</p>
<p>Today we are interested in the three date/time fields as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image3.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb3.png" border="0" alt="image" width="466" height="86" /></a></p>
<p>If you recall in <a href="http://sharepointmagazine.net/technical/administration/a-tribute-to-the-humble-leave-form-part-3" target="_blank">part three</a> where we <a href="http://sharepointmagazine.net/technical/administration/a-tribute-to-the-humble-leave-form-part-3" target="_blank">created the form controls</a>, we gave them the meaningful names of CommenceDate, CompletionDate, ReturnDate.</p>
<p><em>For reference, at any time, you can review your field names easily by clicking the &#8220;Data Source&#8221; link in the InfoPath design pane as shown below.</em></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image31.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image31-thumb.png" border="0" alt="image" width="133" height="332" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image4.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb4.png" border="0" alt="image" width="188" height="329" /></a></p>
<p>So, we have these three date fields and the rules are:</p>
<ul>
<li>The completion date cannot be *before* the commencement date.</li>
<li>The return to work date cannot be *before* the completion date.</li>
</ul>
<p>When you think about what we are doing here, we are <strong>validating data </strong>to make sure that it matches our business rules. Fortunately for us, InfoPath has some nice capabilities here to assist. Even better, they called it &#8220;Data Validation&#8221;. So, let&#8217;s take a closer look&#8230;</p>
<ul>
<li>Select the &#8220;Completion Date&#8221; control, right click and choose &#8220;Data Validation&#8221;</li>
</ul>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image5.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb5.png" border="0" alt="image" width="345" height="301" /></a></p>
<p>You are presented with a fairly unexciting text box asking you to add a <strong>condition</strong> that determines whether the value entered is valid. Clicking the &#8220;Add&#8230;&#8221; button displays the dialog box to add a condition. <em>It is quite common to have multiple conditions that need to be satisfied in order for the data entered to be considered valid</em>.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image6.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb6.png" border="0" alt="image" width="260" height="166" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image7.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb7.png" border="0" alt="image" width="387" height="165" /></a></p>
<p>In our case, we wish to ensure that the CompletionDate field cannot contain a value that is less than the CommenceDate field. Create this condition by specifying &#8220;less than&#8221; from the middle drop down box, and then picking the &#8220;CommenceDate&#8221; field for the third dropdown box.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image8.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb8.png" border="0" alt="image" width="293" height="138" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image9.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb9.png" border="0" alt="image" width="320" height="138" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image10.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb10.png" border="0" alt="image" width="224" height="257" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image11.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb11.png" border="0" alt="image" width="345" height="149" /></a></p>
<p>Clicking OK and we have our completed validation condition!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image12.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb12.png" border="0" alt="image" width="330" height="210" /></a></p>
<p>One final OK and we are back at our form and ready to test this. Rather than publish the form to SharePoint now, we can make use of InfoPath&#8217;s &#8220;Preview&#8221; button on the toolbar and test it out. Below I have an example preview where Homer has been identified as per the <a href="http://sharepointmagazine.net/technical/a-humble-tribute-to-the-leave-form-part-5" target="_blank">previous post</a>. Additionally, I have used the date picker to specify the commencement date (October 25 2008) of leave.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image13.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb13.png" border="0" alt="image" width="445" height="258" /></a></p>
<p>What do you now see on the Completion Date field? What&#8217;s with that red asterix? Maybe I should hover my mouse over it and take a look, eh?</p>
<p>Aww&#8230; How sweet! A tooltip that matches the description I gave for this data validation condition. Well, what do you know? I spelt data instead of date (don&#8217;t worry I&#8217;ll fix it up later).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image14.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb14.png" border="0" alt="image" width="664" height="67" /></a></p>
<p>So, let&#8217;s try and defy time, then. I will enter October 24th as my return date. Doesn&#8217;t seem vary happy does it?</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image15.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb15.png" border="0" alt="image" width="381" height="128" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image16.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb16.png" border="0" alt="image" width="387" height="68" /></a></p>
<p>But if I change the date to the 25th of October (therefore validating the rule we set up), InfoPath happily accepts the value.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image17.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb17.png" border="0" alt="image" width="392" height="64" /></a></p>
<h2>That it? That was easy!</h2>
<p>Yeah, it was very easy so what are you complaining about? <strong>Easy is good </strong>and there should be more of it!</p>
<p>We now need to do the same thing for the &#8220;Return to Work&#8221; form field. Essentially, we perform the very same steps and thankfully for the both of us, I am not going to smother you with screenshots. This is where you try it yourself and instead I will simply list the steps and one screenshot.</p>
<ol>
<li>Right click the ReturnDate field and choose Data Validation</li>
<li>Add a new validation condition where the ReturnDate is less than the CompletionDate</li>
<li>Add a tooltip text &#8220;Return date cannot be before the completion date&#8221;</li>
<li>Click OK twice and test using the preview button</li>
</ol>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image18.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb18.png" border="0" alt="image" width="398" height="171" /></a></p>
<h2>The published experience</h2>
<p>Now that we have successfully tested the validation rules for the date fields, let&#8217;s publish the form to SharePoint and see what it all looks like. I followed the exact publishing steps that I outlined in <a href="http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4" target="_blank">part 4</a>, so please refer to that article if you need a recap.</p>
<p>I navigated to the forms library as described in part 4 and created a new form.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image59.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb57.png" border="0" alt="image" width="244" height="151" /></a></p>
<p>I then deliberately entered bad data into the form and sure enough, the data validation rules picked up on the issue. Excellent &#8211; Waylon Smithers is very pleased!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image85.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image85-thumb.png" border="0" alt="image" width="493" height="394" /></a></p>
<h2>Reviewing our progress&#8230;</h2>
<p>So, since we are about to see off part 6, our Project Manager wants to get a status update on how the Springfield leave form project is progressing. So, after 6 articles, what have we achieved? To remind you, the requirements were:</p>
<li>Automatic identification of requestor</li>
<li>Reduce data entry</li>
<li>Validation of dates, specifically the automatic calculation of days absent (excluding weekends)</li>
<li>Mr Burns is not the only approver, we will need the workflow to route the leave approval to the appropriate supervisor</li>
<li>We have a central leave calendar to update</li>
<p>Identification of Homer is now sorted, and we have taken steps both in the areas of reducing data entry and validating the dates (excluding days absent). So, we are tracking nicely and haven&#8217;t fallen behind schedule just yet <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p>Before we continue with addressing all of these requirements, we will have to take a bit of a detour as I explain below.</p>
<h2>Too good to be true?</h2>
<p>Here&#8217;s a little experiment for you to try. On the above form, published in its current form with deliberately invalid dates (highlighted in red), you will see a toolbar that has a &#8220;Save&#8221;, &#8220;Save As&#8221;, &#8220;Close&#8221; and &#8220;Print View&#8221; on it. I clicked the Save As button and was dutifully prompted for a filename. I called the form &#8220;<strong>Homer&#8217;s Test Form</strong>&#8221; as shown below and clicked Save</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image20.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb20.png" border="0" alt="image" width="343" height="229" /></a></p>
<p>I then closed the form and checked out the form library on the <a href="http://radioactivenet">http://radioactivenet</a> site. What the&#8230;! It saved it! What&#8217;s the point of data validation if you can just save the form anyway?</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/10/image21.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/10/image-thumb21.png" border="0" alt="image" width="565" height="149" /></a></p>
<p>The answer to that question, my friends, is there is a difference between saving a form and <strong>submitting</strong> a form. But you will have to wait for part 7 of this series for that riveting discussion!</p>
<p>Thanks for reading</p>
<p>Paul Culmsee</p>
<p><a href="http://www.cleverworkarounds.com">www.cleverworkarounds.com</a></p>
<p><a href="http://www.sevensigma.com.au">www.sevensigma.com.au</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/a-tribute-to-the-humble-leave-form-part-6/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A tribute to the humble &#8220;leave form&#8221; &#8211; Part 4</title>
		<link>http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4</link>
		<comments>http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4#comments</comments>
		<pubDate>Thu, 11 Sep 2008 08:00:10 +0000</pubDate>
		<dc:creator>cleverworkarounds</dc:creator>
				<category><![CDATA[Customisation]]></category>
		<category><![CDATA[Help]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[infopath]]></category>
		<category><![CDATA[leave]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=308</guid>
		<description><![CDATA[Hi again. Welcome to part 4 of my tribute to the "leave form". It's probably time to just get straight into the article, as I think the whole leave form joke isn't overly funny anymore :-)]]></description>
			<content:encoded><![CDATA[<p>Hi again. Welcome to part 4 of my tribute to the &#8220;leave form&#8221;. It&#8217;s probably time to just get straight into the article, as I think the whole leave form joke isn&#8217;t overly funny anymore <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Crap, there is probably going to be a dozen or so articles and I&#8217;m running out of jokes already?</p>
<p>But then I suddenly remembered that in this certification obsessed IT world we live in, I could make up my very <em>own</em> certification! I mean how hard can it be? Just add the word &#8220;institute&#8221; to your name and your legitimate right?</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/cwabadge.jpg"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/cwabadge-thumb.jpg" border="0" alt="CWAbadge" width="385" height="377" /></a></p>
<p>Therefore I am pleased to unveil the first of a series of certifications to be offered by the CleverWorkarounds Institute and its associated body of knowledge (CIBOK). The <strong>CCLFD</strong> or <strong>CleverWorkarounds Certified Leave Form Developer </strong>certification, which allows certified practitioners the opportunity to feel vastly superior to the mere mortals they work with. Additionally, it has waaaay more bragging rights than one of those weenie certifications like MSCE or CISSP. Of course, like all acronyms to add to your business card, you are certainly guaranteed a big, fat pay rise.</p>
<p>So what someone wants to validate your credentials, you just flash the badge below and they will all be like&#8230;&#8221;wow, this dude is a business process <strong>god</strong>!&#8221;</p>
<h2>SharePoint Pre-Requisites</h2>
<p>Right enough banter and back to business! Now remember, we are in &#8220;Business Development Manager&#8221; mode in this post and therefore we are trying to impress here. Selling the client the message that the you will solve all organisational process issues (and find the answer to world peace) in InfoPath and Forms Services. So far, we have fairly quickly produced a usable InfoPath form. All in all it has taken maybe 10-15 minutes of demo time. So in the interests of &#8220;impress the client at all costs&#8221;, we have done enough to publish it straight into SharePoint, so that it is usable via a web browser.</p>
<p>That CCLFD certification is looking good yes? <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>So first up, we need a SharePoint site to publish the site to. But not just *any* SharePoint server. It needs to be running the <strong>enterprise licence </strong>if you wish to use InfoPath Forms Services.  So sorry stingy people, WSS and Office SharePoint Server 2007 Standard Edition will <strong>not</strong> suffice.</p>
<p><em>Now if this were a demo, I would have already had this set-up in advance to make the client &#8220;ohhh&#8221;, &#8220;aaah&#8221;, &#8220;wooow&#8221; louder. But I think it is worth examining the prerequisites in more detail.</em></p>
<p>Assuming that the SharePoint farm been built and a web application has been created (called <a href="http://radioactivenet">http://radioactivenet</a>), it is time to create a brand new site collection to host this form. The SharePoint farm administrator performs this task in Central Administration -&gt; Application Management. In this example, we are creating a completely blank SharePoint site.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image44.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb42.png" border="0" alt="image" width="298" height="338" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image45.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb43.png" border="0" alt="image" width="285" height="202" /></a></p>
<p>Have we done enough to publish our form to SharePoint? Unfortunately, not quite. In fact if we tried to publish our leave form into the site as it is now, we would have a little warning message that easy to overlook and then cause you no end of wasted time.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image46.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb44.png" border="0" alt="image" width="518" height="73" /></a></p>
<p>But I am getting ahead of myself. Having created this new site collection above, we now need to enable the <strong>enterprise feature-set </strong>that includes the forms services component that we need. For the purposes of this post, I will not be explaining the SharePoint feature framework, but for the uninitiated, SharePoint is like a fisher-price toy with lots of buttons that have different effects when pushed. (We haven&#8217;t yet pushed the right button). <em>Think about SharePoint site templates (e.g Document Workspace, Wiki Site) as automatically pressing the buttons for you. </em></p>
<p>To activate the enterprise featureset, we log into <a href="http://radioactivenet">http://radioactivenet</a> as an administrator or site collection administrator. Choose the &#8220;Site Actions&#8221; drop down menu below the search box. Choose &#8220;Site Settings&#8221; and you will be taken to the administrative back-end of a SharePoint site collection. I have highlighted the option to control site collection features. (Click to zoom)</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image47.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb45.png" border="0" alt="image" width="323" height="157" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image48.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb46.png" border="0" alt="image" width="393" height="56" /></a></p>
<p>This screen shows you all of the nice buttons to push. The one that we need for this demonstration is the &#8220;Office SharePoint Server Enterprise Site Collection Features&#8221;. Simply the click &#8220;Activate&#8221; and you are done!</p>
<h2>Finally, let&#8217;s publish it already!</h2>
<p>To remind you all of where we got to at part 3, we have a functional form looking like this. (Click to expand)</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image49.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb47.png" border="0" alt="image" width="244" height="148" /></a></p>
<p>Publishing an InfoPath form into SharePoint is based on a Wizard. We want to impress here, so we will do a straightforward form publication. Start the wizard by choosing &#8220;Publish&#8221; from the &#8220;File menu&#8221;. The first wizard screen will ask you *where* you wish to publish to. Obviously we go with the default answer of SharePoint <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image50.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb48.png" border="0" alt="image" width="244" height="216" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image51.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb49.png" border="0" alt="image" width="439" height="120" /></a></p>
<p>Next we are asked to specify which SharePoint site we would like to deploy this new form to. We are using our newly created <a href="http://radioactivenet">http://radioactivenet</a> site.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image52.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb50.png" border="0" alt="image" width="439" height="132" /></a></p>
<p>Now we hit the first important step in the whole process. This is the step where InfoPath publishing wizard asks you to <strong>how</strong> to publish this form. While I am not going to explain each option in detail at this stage, I will warn you now that we are going to come back to this screen in subsequent posts.</p>
<p>Notice how &#8220;Enable this form to be filled out by using a browser&#8221; is checked? This is because this InfoPath form that we created has been set to be &#8220;browser compatible&#8221; way back in part 2 when we first created the form template.</p>
<p>The first and default choice is to create the form in a SharePoint Document Library. Thus in the SharePoint world, InfoPath forms are just another type of library storage. therefore you can can use version history, recycle bin and all of the other goodies that come with SharePoint document libraries. Now I should make it clear though, that SharePoint creates a special type of library called a &#8220;Form Library&#8221;, designed specifically for InfoPath forms. So we leave &#8220;Document Library&#8221; chosen as the default and click continue on.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image53.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb51.png" border="0" alt="image" width="425" height="203" /></a></p>
<p>Having chosen to use a document library we are now asked to create a new one or choose an existing library. In our case, we have not yet created the library to hold the leave form, so we choose to &#8220;Create a new document library&#8221; and then enter it&#8217;s name and description into the follow-up dialog box. This will create a form library called &#8220;Leave Forms&#8221; for us as part of the publishing process.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image54.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb52.png" border="0" alt="image" width="369" height="127" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image55.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb53.png" border="0" alt="image" width="283" height="124" /></a></p>
<p>The next step is another important one. But in the interests of our &#8220;impress the client at all costs&#8221; focus, we are going to leave it until the next post. So we click Next to continue.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image56.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb54.png" border="0" alt="image" width="548" height="172" /></a></p>
<p>That&#8217;s it for the publishing process! Clicking the Publish button will commence the process. InfoPath will create the form library and when it finished provide us with a summary of what has been performed as shown below. You can see the name of the library where the form was published (&#8220;Leave Forms&#8221;), the URL of the SharePoint site (<a href="http://radioactivenet/leave">http://radioactivenet/leave</a> forms) and the fast that Infopath Forms services is running on the server.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image57.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb55.png" border="0" alt="image" width="546" height="220" /></a></p>
<h2>The new form library</h2>
<p>So, are we ready to &#8220;wow&#8221; the client yet? Almost!</p>
<p>Looking at the <a href="http://radioactivenet">http://radioactivenet</a> site, we can now see that we have a new content item in the navigation. Well what do you know? <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  It&#8217;s a leave form library!!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image58.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb56.png" border="0" alt="image" width="502" height="346" /></a></p>
<p>If you navigate to this document library, you will see that it pretty much looks like any other SharePoint document library. Clicking the New drop down in the document library though shows that something is subtly different with this library. The document type to create has the InfoPath symbol on it. This library <strong>knows</strong> that it is here to store InfoPath forms.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image59.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb57.png" border="0" alt="image" width="244" height="151" /></a></p>
<p>But there is one minor catch. By default, SharePoint assumes that if you have InfoPath installed on your PC, then you will always prefer to use InfoPath in preference to a more limited, somewhat &#8220;clunkier&#8221; web based version. In our case, we want the form to show up in a browser, irrespective or whether InfoPath is installed on you PC. So let&#8217;s do that now.</p>
<p>In the new Leave Forms library, we choose &#8220;Form Library Settings&#8221; from the &#8220;Settings&#8221; drop down menu as shown below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image60.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb58.png" border="0" alt="image" width="340" height="169" /></a></p>
<p>Now remember how I said that a forms library is a document library geared especially to host InfoPath forms? Well, now you get to see why. One of the configuration options unique to a forms library is whether to display a form in a browser or using InfoPath. The option controlling this can be found in &#8220;Advanced Settings&#8221; as highlighted below. The third option under advanced settings controls the behaviour for &#8220;browser enabled&#8221; documents. Note that the default option is to &#8220;Open in the client application&#8221;.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image61.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb59.png" border="0" alt="image" width="302" height="182" /></a> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image62.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb60.png" border="0" alt="image" width="329" height="261" /></a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image63.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb61.png" border="0" alt="image" width="478" height="81" /></a></p>
<p>So let&#8217;s change this to &#8220;Display as a web page&#8221; and click OK. Also note the second option, &#8220;Document Template&#8221;. We will be talking about this a subsequent post as well.</p>
<h2>The big test!</h2>
<p>So, all is now in place and it is time to demonstrate the functionality to your eager and excited clients. Go back to the home page of <a href="http://radioactivenet">http://radioactivenet</a> and choose &#8220;Leave Forms&#8221; from the navigation bar. In the document library view, choose &#8220;New Document&#8221; from the &#8220;New&#8221; drop down.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image59.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb57.png" border="0" alt="image" width="244" height="151" /></a></p>
<p>Wohoo! The form renders in the browser! (and the crowd goes wild! <img src='http://sharepointmagazine.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/07/image64.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2008/07/image-thumb62.png" border="0" alt="image" width="572" height="430" /></a></p>
<h2>Conclusion</h2>
<p>So there you go, in something like 20-25 minutes, you have created and published a web based form that started life as a MSWord template. Highlighting how long this world have taken to be custom developed, your client is already writing a cheque and wants you to do this with all of their internal forms right???</p>
<p>Whatsmore, we haven&#8217;t even gotten to the unbridled joy that is a workflow yet! Oh man if the client likes forms services, they ain&#8217;t seen nothin&#8217; yet right???</p>
<p>Well, to be honest, this form really isn&#8217;t that smart yet is it? Before we even get to workflow considerations, the form still isn&#8217;t *that* friendly and we haven&#8217;t yet satisfied several of the requirements outlined in <a href="http://sharepointmagazine.net/technical/development/a-tribute-to-the-humble-leave-form" target="_blank">part 1</a>. Remember that we had to provide:</p>
<li>Automatic identification of requestor</li>
<li>Reduce data entry</li>
<li>Validation of dates, specifically the automatic calculation of days absent (excluding weekends)</li>
<li>Mr Burns is not the only approver, we will need the workflow to route the leave approval to the right supervisor</li>
<li>We have a central leave calendar to updateSo in the next post, we will make this form a little smarter and see if it is still within the realms of mere mortals (non developers) to do.thanks for readingPaul Culmsee<a href="http://www.cleverworkarounds.com">www.cleverworkarounds.com</a></li>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/customisation/a-tribute-to-the-humble-leave-form-part-4/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
