<?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>Use. Able. Web. &#187; notes</title>
	<atom:link href="http://www.useableweb.net/blog/tag/notes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.useableweb.net/blog</link>
	<description>A blog on Lotus Notes development, web usability and technology ramblings.</description>
	<lastBuildDate>Mon, 18 Jan 2010 23:24:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Hiding div blocks using Javascript DOM and Checkboxes</title>
		<link>http://www.useableweb.net/blog/2009/02/25/javascript-dom-and-checkboxes/</link>
		<comments>http://www.useableweb.net/blog/2009/02/25/javascript-dom-and-checkboxes/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 13:51:27 +0000</pubDate>
		<dc:creator>rodney</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Lotus Notes and Domino]]></category>
		<category><![CDATA[domino]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://useableweb.net/blog/?p=115</guid>
		<description><![CDATA[Lotus Domino has a unique function to hide certain elements of a design element called &#8220;Hide-Whens&#8221;. Basically, this text option can be set to hide a field, text or code based on a formula. But, if you plan on using this on the web and would like it to be triggered by a field change [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-129" style="border: 0pt none; margin: 5px;" title="Code" src="http://useableweb.net/blog/wp-content/uploads/2009/02/icode.jpg" alt="Code" width="121" height="90" />Lotus Domino has a unique function to hide certain elements of a design element called &#8220;Hide-Whens&#8221;. Basically, this text option can be set to hide a field, text or code based on a formula. But, if you plan on using this on the web and would like it to be triggered by a field change event, more than likely you will need to refresh the entire form so the hide-whens will take effect.</p>
<p>This is not pretty especially if you have several fields refreshing and controlling other fields or texts. Also, this presents other problems because constant refreshing slows down your application.</p>
<p>So the use of Javascript DOM for hiding objects inside a DIV can prove useful if you would like that users be able complete a form without refreshing it from the get go.</p>
<p><em><strong>object.style.display=value</strong></em></p>
<p>Toggling this <a title="Object.style.display" href="http://www.w3schools.com/htmldom/prop_style_display.asp" target="_blank">DOM property&#8217;s</a> value to &#8220;none&#8221; would work the same way as a hide-when when you can create a function from it using the fields on your form. For my example below, I used a checkbox field to trigger the function and toggle the display property based on the value of the field.</p>
<p>Here is a simple <a title="Toggle Demo" href="http://useableweb.net/demos/check_demo.html" target="_blank">demo</a> in HTML. This is easier though to implement in Notes as you can just place the function in the onchange event of a field. You can also further develop the function if you are using multiple checkboxes  or if you have a more complex rule on hiding/displaying the fields.</p>
<p>Use, the following function on the onchange event of your checkbox:</p>
<blockquote><p>toggledisplay(&#8216;<em>div id</em>&#8216;, &#8216;<em>field id</em>&#8216;, &#8216;<em>value you would like to check</em>&#8216;);</p></blockquote>
<p>Here is the javascript function:</p>
<blockquote><p>function toggledisplay(divname, checkfield, checkvalue)<br />
{<br />
var count=0;<br />
var fdivname = document.getElementById(divname);<br />
var fcheckfield = document.getElementsByName(checkfield);</p>
<p>for (var z = 0; z &lt;fcheckfield.length;z++) {<br />
if (fcheckfield[z].checked) {<br />
if (fcheckfield[z].value == checkvalue) {count=1;}<br />
}<br />
}</p>
<p>if (count==1 )<br />
{fdivname.style.display = &#8220;&#8221;;}<br />
else<br />
{fdivname.style.display = &#8220;none&#8221;;}<br />
}</p></blockquote>

	Tags: <a href="http://www.useableweb.net/blog/tag/domino/" title="domino" rel="tag">domino</a>, <a href="http://www.useableweb.net/blog/tag/lotus/" title="Lotus Notes and Domino" rel="tag">Lotus Notes and Domino</a>, <a href="http://www.useableweb.net/blog/tag/notes/" title="notes" rel="tag">notes</a>, <a href="http://www.useableweb.net/blog/tag/web/" title="Web" rel="tag">Web</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.useableweb.net/blog/2009/02/25/javascript-dom-and-checkboxes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

