<?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>Lotushints &#187; Custom forms</title>
	<atom:link href="http://www.lotushints.com/category/custom-forms/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lotushints.com</link>
	<description>Lotus Notes tips &#38; tricks you always hoped you will not need</description>
	<lastBuildDate>Wed, 14 Jul 2010 06:00:04 +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>Custom web forms &#8211; Part 3: User input form</title>
		<link>http://www.lotushints.com/2009/04/custom-web-forms-part-3-user-input-form/</link>
		<comments>http://www.lotushints.com/2009/04/custom-web-forms-part-3-user-input-form/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 08:00:25 +0000</pubDate>
		<dc:creator>Vladimir Kocjancic</dc:creator>
				<category><![CDATA[Basic]]></category>
		<category><![CDATA[Custom forms]]></category>
		<category><![CDATA[Lotus Notes]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[form]]></category>

		<guid isPermaLink="false">http://www.lotushints.com/?p=297</guid>
		<description><![CDATA[In parts 1 and 2, we looked at exporting forms to DXL and then importing them back. In this short article,we will look at a simple form that will allow users to assemble their own web form. So what do I need? First, we need to assmble list of fields user needs to add. Each [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.lotushints.com/category/custom-forms/">parts 1 and 2</a>, we looked at exporting forms to DXL and then importing them back. In this short article,we will look at a simple form that will allow users to assemble their own web form.<br />
<span id="more-297"></span><br />
<strong>So what do I need?</strong></p>
<p>First, we need to assmble list of fields user needs to add. Each field usually has a label that describes to a user what information should he enter. Then, some fields are plain text, rich text, checkboxes, etc. Also, fields can have a default value.</p>
<p>Keeping that in mind, a basic web form usually has a field named $$Return, that specifies what happens on document submit. Also, it would be nice, if we allowed our users to enter name of the form and some short description that will be presented in web form.</p>
<p><strong>The implementation</strong></p>
<p>For basic forms, we don&#8217;t need anything fancy. No rich text for short description, probably only simplest field formats (plain text, rich text, radiobutton and checkbox) and probably not more than 10 fields. Since this example is here just to prove a case, I will limit it to 5 different fields.</p>
<p>So, our list of fields now looks like this:</p>
<ul>
<li>form name</li>
<li>form description</li>
<li>return page</li>
<li>5x field that will hold field name</li>
<li>5x field that will be used for field type</li>
<li>5x field with value (in case of radiobutton and checkbox)</li>
<li>5x field with default value</li>
<li>5x field with label</li>
</ul>
<p>The &#8220;finished&#8221; form is displayed in picture below.</p>
<div id="attachment_299" class="wp-caption aligncenter" style="width: 300px"><img class="size-medium wp-image-299" title="myclientform" src="http://www.lotushints.com/wp-content/uploads/2009/04/myclientform-300x158.png" alt="Filled user's form" width="300" height="158" /><p class="wp-caption-text">Filled user&#39;s form</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.lotushints.com/2009/04/custom-web-forms-part-3-user-input-form/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Custom web forms &#8211; Part 2: Importing Form from DXL</title>
		<link>http://www.lotushints.com/2009/03/custom-web-forms-part-2-importing-form-from-dxl/</link>
		<comments>http://www.lotushints.com/2009/03/custom-web-forms-part-2-importing-form-from-dxl/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 08:00:47 +0000</pubDate>
		<dc:creator>Vladimir Kocjancic</dc:creator>
				<category><![CDATA[Basic]]></category>
		<category><![CDATA[Custom forms]]></category>
		<category><![CDATA[Lotus Notes]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[dxl]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[import]]></category>

		<guid isPermaLink="false">http://www.lotushints.com/?p=260</guid>
		<description><![CDATA[In the second part of Custom web forms series I will try to cover import of simple form to Notes database from DXL file. If you wonder how to export a form to DXL, please check Part 1: Exporting Form into DXL. Requirements As mentioned, you will need a DXL file like the result of [...]]]></description>
			<content:encoded><![CDATA[<p>In the second part of <a href="/category/custom-forms/">Custom web forms series</a> I will try to cover import of simple form to Notes database from DXL file. If you wonder how to export a form to DXL, please check <a href="/2009/03/custom-web-forms-part-1-exporting-form-into-dxl/">Part 1: Exporting Form into DXL</a>.<br />
<span id="more-260"></span></p>
<p><strong>Requirements</strong></p>
<p>As mentioned, you will need a DXL file like the result of <a href="/2009/03/custom-web-forms-part-1-exporting-form-into-dxl/">Part 1</a>. Beware that, if you have altered the file and removed the DOCTYPE tag, you will not be able to import DXL and you will either need to add correct DOCTYPE tag back or export the form again.</p>
<p><strong>The code</strong></p>
<p>The code itself is pretty straightforward. You need to open a DXL file as a NotesStream object and then use NotesDXLImporter class to import a DXL to your database. There is a catch. You need to set <strong>DesignImportOption</strong> property of NotesDXLImporter object to create design element. These options are specified in Notes Designer Help.</p>
<pre>Dim session As New NotesSession
Dim dbCurr As NotesDatabase
Dim docForm As NotesDocument
Dim stream As NotesStream
Dim dxlImporter As NotesDXLImporter
Dim strFile As String

Set dbCurr = session.CurrentDatabase
Set stream = session.CreateStream ()

strFile = "c:\download\templateform.xml"
If (Not stream.Open (strFile, "utf-8")) Then
   Exit Sub
End If

Set dxlImporter = session.CreateDXLImporter (stream, dbCurr)
dxlImporter.DesignImportOption =_
DXLIMPORTOPTION_REPLACE_ELSE_CREATE
Call dxlImporter.Process ()</pre>
<p>Just in case you don&#8217;t want to check Notes help for values, here are DXL import options:</p>
<ul>
<li> DXLIMPORTOPTION_CREATE (1)</li>
<li> DXLIMPORTOPTION_IGNORE (2)</li>
<li> DXLIMPORTOPTION_REPLACE_ELSE_IGNORE (5)</li>
<li> DXLIMPORTOPTION_REPLACE_ELSE_CREATE (6)</li>
<li> DXLIMPORTOPTION_UPDATE_ELSE_IGNORE (9)</li>
<li> DXLIMPORTOPTION_UPDATE_ELSE_CREATE (10)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.lotushints.com/2009/03/custom-web-forms-part-2-importing-form-from-dxl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom web forms &#8211; Part 1: Exporting Form into DXL</title>
		<link>http://www.lotushints.com/2009/03/custom-web-forms-part-1-exporting-form-into-dxl/</link>
		<comments>http://www.lotushints.com/2009/03/custom-web-forms-part-1-exporting-form-into-dxl/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 08:00:12 +0000</pubDate>
		<dc:creator>Vladimir Kocjancic</dc:creator>
				<category><![CDATA[Basic]]></category>
		<category><![CDATA[Custom forms]]></category>
		<category><![CDATA[Lotus Notes]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[dxl]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[form]]></category>

		<guid isPermaLink="false">http://www.lotushints.com/?p=248</guid>
		<description><![CDATA[The one thing that in my opinion always lacked in Lotus Notes was the ability for users without designer access (and much knowledge of HTML) to build their own custom forms. One might argue that it is not that big of a deal and that it would take an experienced developer approximately one hour to [...]]]></description>
			<content:encoded><![CDATA[<p>The one thing that in my opinion always lacked in Lotus Notes was the ability for users without designer access (and much knowledge of HTML) to build their own custom forms. One might argue that it is not that big of a deal and that it would take an experienced developer approximately one hour to create and test such a form. However, developers usually have more important work to do and this is an hour unnecessary spent.</p>
<p><span id="more-248"></span></p>
<p><strong>How to get around&#8230;</strong></p>
<p>I am positive that different developers would handle this differently. For sure, the easiest thing to do would be to add designer access to a person wishes to create a form. I would advise against it. Not only it creates severe security issue, but it also enables inexperienced user to poke about the database design.</p>
<p>I am positive every designer till now at least heard of DXL. Some of us even used it. I did it for exporting entire database to our internal wiki and to create atom rss for another database. However, most developers, in my experience, look at DXL as a bit of a Notes voodoo.</p>
<p><strong>Let&#8217;s remove this tag!</strong></p>
<p>In several parts, I will try to show how to export and import a simple HTML form that one can use on the web. Also at the very end, I will try to create a form that will enable a user with less than developer access to create a web form.</p>
<p><strong>Onward, to the point &#8211; Exporting Form to DXL<br />
</strong></p>
<p>It is quite simple. You create or already posses a form. For exporting it to DXL, you will need to know it&#8217;s name or you can enable for to be available in Create menu and add a shared action onto it, that will do the work for you. I decided for the later.</p>
<div id="attachment_250" class="wp-caption aligncenter" style="width: 479px"><img class="size-full wp-image-250" title="myform" src="http://www.lotushints.com/wp-content/uploads/2009/03/myform.png" alt="Form with shared action as viewed in Notes client" width="469" height="282" /><p class="wp-caption-text">Form with shared action as viewed in Notes client</p></div>
<p style="text-align: left;">Figure above displays a simple form previewed in Notes client with shared action &#8220;Export form&#8221;in action bar. Upon clicking on this action, a file will be saved on your disk to path c:\download\my_form_name.xml. And below is the code that does all this.</p>
<pre>Sub Click(Source As Button)
   Dim ws As New NotesUIWorkspace
   Dim s As New NotesSession
   Dim db As NotesDatabase
   Dim nc As NotesNoteCollection
   Dim doc As NotesDocument
   Dim docForm As NotesDocument
   Dim stream As NotesStream
   Dim dxlExporter As NotesDXLExporter
   Dim bFound As Boolean
   Dim n As Integer
   Dim strId As String
   Dim strFormName As String

   Set db = s.CurrentDatabase
   Set doc = ws.CurrentDocument.Document
   Set nc = db.CreateNoteCollection (False)
   nc.SelectForms = True
   Call nc.BuildCollection ()

   bFound = False
   strId = nc.GetFirstNoteId ()
   For n = 1 To nc.Count
      Set docForm = db.GetDocumentByID (strId)
      strFormName = docForm.GetFirstItem ("$title").values(0)
      If (doc.Form (0) = strFormName) Then
         bFound = True
         Exit For
      End If
      strId = nc.GetNextNoteId (strId)
   Next

   If (Not bFound) Then Exit Sub

   Set stream = s.CreateStream ()
   Call stream.Open("c:\download\" &amp; strFormName &amp; ".xml","utf-8")
   Call stream.Truncate ()

   Set dxlExporter = s.CreateDXLExporter (docForm, stream)
   Call dxlExporter.Process
   Call stream.Close ()
End Sub</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.lotushints.com/2009/03/custom-web-forms-part-1-exporting-form-into-dxl/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
