<?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>Ricardo Parente&#039;s Blog &#187; Javascript</title>
	<atom:link href="http://ricardo.parente.us/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://ricardo.parente.us</link>
	<description>ColdFusion Developers Network</description>
	<lastBuildDate>Fri, 10 Feb 2012 17:13:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>ColdFusion MeetUp: Developing Enterprise AJAX Applications Using Ext-JS 4 with Steve Drucker</title>
		<link>http://ricardo.parente.us/2011/06/coldfusion-meetup-developing-enterprise-ajax-applications-using-ext-js-4-with-steve-drucker/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=coldfusion-meetup-developing-enterprise-ajax-applications-using-ext-js-4-with-steve-drucker</link>
		<comments>http://ricardo.parente.us/2011/06/coldfusion-meetup-developing-enterprise-ajax-applications-using-ext-js-4-with-steve-drucker/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 21:45:58 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Ext-JS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MeetUp]]></category>
		<category><![CDATA[Seminars]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Webinars]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=6058</guid>
		<description><![CDATA[Announcing a new Meetup for The Online ColdFusion Meetup! What: &#8220;Developing Enterprise AJAX Applications Using Ext-JS 4&#8243; with Steve Drucker Our 12pm (US ET) talk on Thursday June 16 will be &#8220;Developing Enterprise AJAX Applications Using Ext-JS 4&#8243; with Steve Drucker.   TOPIC DESCRIPTION: (provided by the speaker) Ext JS 4 is a major advance in JavaScript frameworks. [...]]]></description>
			<content:encoded><![CDATA[<p>Announcing a new Meetup for The Online ColdFusion Meetup!</p>
<p><strong>What</strong>: <a title="http://www.meetup.com/coldfusionmeetup/events/21825561/" href="http://www.meetup.com/coldfusionmeetup/events/21825561/" target="_blank">&#8220;Developing Enterprise AJAX Applications Using Ext-JS 4&#8243; with Steve Drucker</a><br />
<strong></strong><br />
Our 12pm <strong>(US ET)</strong> talk on Thursday June 16 will be &#8220;Developing Enterprise AJAX Applications Using Ext-JS 4&#8243; with Steve Drucker.  <strong> </strong></p>
<p><strong>TOPIC DESCRIPTION:</strong> (provided by the speaker)</p>
<p>Ext JS 4 is a major advance in JavaScript frameworks. Learn about its new features including Flash-free drawing and charting, an advanced data-handling package, the best datagrid commercially available, support for HTML 5 features, enhanced form validation feedback, easy theming using SASS &amp; Compass, and an object-oriented MVC framework that ties everything together. Best of all, Ext 4 applications can now be made to be Section 508 compliant, localized for international support, and are backwards-compatible to IE 6.</p>
<p><strong>MEETING URL: <a title="http://experts.acrobat.com/cfmeetup/" href="http://experts.acrobat.com/cfmeetup/" target="_blank">http://experts.acrobat.com/cfmeetup/</a></strong></p>
<p><strong><span id="more-6058"></span>DURATION:</strong> Approx. 1 hour</p>
<p><strong>RECORDING: All meetings are recorded.</strong> The URL will be posted after meeting at <strong><a title="http://recordings.coldfusionmeetup.com/" href="http://recordings.coldfusionmeetup.com/" target="_blank">recordings.coldfusionmeetup.com</a></strong></p>
<p><strong>SPEAKER:</strong> (provided by the speaker)</p>
<p>Steve Drucker, Founder/President of Fig Leaf Software, has been implementing innovative, award-winning web sites with Adobe tools since 1996. Steve served as principal architect for two of the largest ColdFusion implementations ever &#8211; the Voice of America and National Park Service.  He has been a featured speaker at several trade shows including the Adobe MAX Developers Conference and CFUnited. Steve has developed about a dozen hands-on, instructor led courses &#8212; including acting as course architect and lead developer for Adobe&#8217;s official Advanced ColdFusion 9 courseware and is currently in the process of authoring the official instructor-led courseware for all of Sencha&#8217;s products. Recently he completed authoring &#8220;Fast Track to Sencha Touch&#8221; and &#8220;Upgrading to Ext JS 4&#8243;. Steve became a certified Adobe instructor in October 1997, and earned an &#8220;Adobe Master Instructor&#8221; rating in 2003. He is a certified instructor for ColdFusion, Acrobat, Dreamweaver, Presto, CommonSpot, JavaScript / AJAX, SQL, Adobe LiveCycle ES, Adobe Presenter, Sencha Touch, and Ext JS 4.</p>
<p><strong>WHEN:</strong> Thurs. June 16, 12:00pm <strong>US ET (UTC/GMT-4)</strong></p>
<p><strong>What time is that for you?</strong> The following link shows <strong>[ <a title="http://permatime.com/US/Eastern/2011-06-16/12:00/" href="http://permatime.com/US/Eastern/2011-06-16/12:00/" target="_blank">what the time would be for you</a>]</strong>. Here&#8217;s <strong>[ <a title="http://www.timeanddate.com/worldclock/fixedtime.html?year=2011&amp;month=06&amp;day=16&amp;hour=12&amp;min=00&amp;sec=0&amp;p1=25" href="http://www.timeanddate.com/worldclock/fixedtime.html?year=2011&amp;month=06&amp;day=16&amp;hour=12&amp;min=00&amp;sec=0&amp;p1=25" target="_blank">another option</a>]</strong> that shows the time as US ET, and lets you choose your city from the list offered to see what time that is in your own timezone.</p>
<p><strong>RECORDING:</strong> As always, the meeting will be recorded, and the recording URL will be posted after the meeting at <a title="http://recordings.coldfusionmeetup.com/" href="http://recordings.coldfusionmeetup.com/" target="_blank">http://recordings.coldfusionmeetup.com</a>.</p>
<p><strong>DOWNLOADABLE RECORDINGS:</strong><br />
In addition to the streaming recording posted immediately after the meeting, we now also post downloadable recordings (FLV, MP3, MP4, and WMV) usually within a few days after the meeting, also offered as a link from the recordings page.</p>
<p><strong>LOGGING IN:</strong> When you login to the Connect room (the<a title="http://experts.acrobat.com/cfmeetup" href="http://experts.acrobat.com/cfmeetup" target="_blank"> experts.acrobat.com/cfmeetup</a> link above) to view the meeting, PLEASE USE THE &#8220;LOGIN AS GUEST&#8221; option, and USE YOUR NAME, but do NOT attempt to use your <a title="http://meetup.com/" href="http://meetup.com/" target="_blank">meetup.com</a> username/password or any Connect account. Just sign in as a guest.</p>
<p><strong>RSVP, but only if coming:</strong> We do appreciate folks RSVPing if they plan to come (using the link on this email or at the meetup site), though it&#8217;s not mandatory and it&#8217;s not a commitment. But there&#8217;s<strong>no need to RSVP if you can&#8217;t make it</strong> let alone explain why you can&#8217;t. With over 2,500 members, no worries. <img src='http://ricardo.parente.us/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>FEEDBACK/MEETING DISCUSSION</strong>: Members will receive an email after the meeting or can click a link on the event page to offer. Note also the meeting-specific discussion area there at the bottom, in addition to the one-chance feedback feature on the right. Feel free to engage in discussions about the meeting topic.</p>
<p><strong>ADD THIS TO YOUR CALENDAR:</strong> Want to add this event to your own personal calendar? After logging in here, you&#8217;ll see an option at the top of the event page, just below the event title,  saying, &#8220;Add to my calendar&#8221;, which offers calendar downloads for Outlook, iCal, Google, and Yahoo calendars. (Note that the calendar entry created will show the event taking 2 hours. That&#8217;s a default that <a title="http://meetup.com/" href="http://meetup.com/" target="_blank">meetup.com</a> has chosen, which I can&#8217;t change. The meetings are generally about an hour, though often go as much as 30-45 minutes longer with Q&amp;A and chat.)</p>
<p><strong><a title="http://www.meetup.com/coldfusionmeetup/events/21825561/" href="http://www.meetup.com/coldfusionmeetup/events/21825561/" target="_blank">Check it out!</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2011/06/coldfusion-meetup-developing-enterprise-ajax-applications-using-ext-js-4-with-steve-drucker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery Custom Events: A Deeper Look</title>
		<link>http://ricardo.parente.us/2010/10/jquery-custom-events-a-deeper-look/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-custom-events-a-deeper-look</link>
		<comments>http://ricardo.parente.us/2010/10/jquery-custom-events-a-deeper-look/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 16:21:48 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[custom events]]></category>
		<category><![CDATA[Hal Helms]]></category>
		<category><![CDATA[shopping cart]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=3877</guid>
		<description><![CDATA[A good article on JQuery custom events by Hal Helms. http://www.halhelms.com/blog/index.cfm/2010/10/24/jQuery-Custom-Events&#8211;A-Deeper-Look]]></description>
			<content:encoded><![CDATA[<p>A good article on JQuery custom events by Hal Helms.</p>
<p><a title="http://www.halhelms.com/blog/index.cfm/2010/10/24/jQuery-Custom-Events--A-Deeper-Look" href="http://www.halhelms.com/blog/index.cfm/2010/10/24/jQuery-Custom-Events--A-Deeper-Look" target="_blank"><strong>http://www.halhelms.com/blog/index.cfm/2010/10/24/jQuery-Custom-Events&#8211;A-Deeper-Look</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2010/10/jquery-custom-events-a-deeper-look/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery UI 1.8.4 Released</title>
		<link>http://ricardo.parente.us/2010/08/jquery-ui-1-8-4-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-ui-1-8-4-released</link>
		<comments>http://ricardo.parente.us/2010/08/jquery-ui-1-8-4-released/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 13:44:22 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=3025</guid>
		<description><![CDATA[The fourth maintenance release for jQuery UI 1.8 is out. This update brings bug fixes for the Droppable, Resizable, Selectable and Sortable interactions as well as the Accordion, Autocomplete, Button, Datepicker Dialog, Progressbar, Slider and Tabs widgets. jQuery UI 1.8.3 was released a few days prior to 1.8.4, but there was a problem with the [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>The fourth maintenance release for jQuery UI 1.8 is out. This update  brings bug fixes for the Droppable, Resizable, Selectable and Sortable  interactions as well as the Accordion, Autocomplete, Button, Datepicker  Dialog, Progressbar, Slider and Tabs widgets. jQuery UI 1.8.3 was  released a few days prior to 1.8.4, but there was a problem with the  build system that caused some of the files to not contain any copyright  information.</p>
<p>If you noticed the 1.8.3 release and upgraded, please  upgrade to 1.8.4.</p></blockquote>
<p>You can download it <a href="http://blog.jqueryui.com/2010/08/jquery-ui-1-8-4/" target="_blank"><strong>here</strong></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2010/08/jquery-ui-1-8-4-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Query Sorted Results in HTML Table, Better Approach</title>
		<link>http://ricardo.parente.us/2008/12/query-sorted-results-in-html-table-better-approach/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=query-sorted-results-in-html-table-better-approach</link>
		<comments>http://ricardo.parente.us/2008/12/query-sorted-results-in-html-table-better-approach/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 05:49:32 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[sorted headers]]></category>
		<category><![CDATA[sorttable.js]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=287</guid>
		<description><![CDATA[I received a comment in my other article with the same title from Larry C. Lyons indicating me a better solution by Stuart Langridge making use of a Javascript library he wrote called sorttable.js, which sorts the HTML table by sortable headers, without having to send another request to the database. Very well done, congratulations Stuart.]]></description>
			<content:encoded><![CDATA[<p>I received a comment in my other <a title="Query Sorted Results in HTML Table" href="http://ricardo.parente.us/?p=234" target="_self"><em>article with the same title</em></a> from <strong>Larry C. Lyons</strong> indicating me a better solution by <a title="Stuart Langridge - kryogenix" href="http://www.kryogenix.org/" target="_blank"><strong>Stuart Langridge</strong></a> making use of a Javascript library he wrote called <a title="Make all your tables sortable" href="http://kryogenix.org/code/browser/sorttable/" target="_blank"><em>sorttable.js</em></a>, which sorts the HTML table by sortable headers, without having to send another request to the database.<br />
Very well done, congratulations Stuart.</p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2008/12/query-sorted-results-in-html-table-better-approach/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To Grey-Out the Screen</title>
		<link>http://ricardo.parente.us/2008/12/how-to-grey-out-the-screen/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-grey-out-the-screen</link>
		<comments>http://ricardo.parente.us/2008/12/how-to-grey-out-the-screen/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 05:08:10 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[grey-out]]></category>
		<category><![CDATA[Lightbox]]></category>
		<category><![CDATA[modal environment]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=285</guid>
		<description><![CDATA[ This is an article very interesting for those who want to apply the effects of LightBox to your alert windows. I found this article on a post by Patrick Hunlock where he says: This snippet &#8220;grays&#8221; out the screen and allows you to create a &#8220;modal&#8221; environment. A gray out is useful for creating a DHTML [...]]]></description>
			<content:encoded><![CDATA[<p> This is an article very interesting for those who want to apply the effects of LightBox to your alert windows. I found this article on a post by Patrick Hunlock where he says:</p>
<blockquote><p>This snippet &#8220;grays&#8221; out the screen and allows you to create a &#8220;modal&#8221; environment. A gray out is useful for creating a DHTML dialog box, or showing off a picture or video.</p></blockquote>
<p><a title="How To Grey Out the Screen" href="http://www.hunlock.com/blogs/Snippets:_Howto_Grey-Out_The_Screen" target="_blank"><strong>Here</strong></a> is the link.</p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2008/12/how-to-grey-out-the-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Session Timeout Notice Using Javascript</title>
		<link>http://ricardo.parente.us/2008/10/session-timeout-notice-using-javascript/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=session-timeout-notice-using-javascript</link>
		<comments>http://ricardo.parente.us/2008/10/session-timeout-notice-using-javascript/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 21:22:58 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[CFAJAX]]></category>
		<category><![CDATA[session timeout]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=225</guid>
		<description><![CDATA[Sometimes in an Intranet you need to notify the client that his session is about to expire and let him to decide if he will renew his session or let it die. That can be done either on server or client side. We will discuss here the client-side way using Javascript and/or Ajax to refresh [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes in an Intranet you need to notify the client that his session is about to expire and let him to decide if he will renew his session or let it die. That can be done either on server or client side.</p>
<p>We will discuss here the client-side way using Javascript and/or Ajax to refresh the session.<br />
The script offers two ways of refreshing the session, one by just reloading the page and other by calling an Ajax function.</p>
<p>If your template is a form, you will want definitively to use Ajax, or you would lose all the fields already filled in. If you are in a simple display page, refreshing that page will not cause any problems.</p>
<p>So, I used a sample my friend <a href="http://pcsilva.blogspot.com/" title="Pedro Claudio" target="_blank"><strong>Pedro Claudio</strong></a> posted on the CF-Brasil mailing group, and modified it to be used in CF templates with CFAJAX components (not the CF8 tag). I also modified it to use the Javascript function &#8220;setInterval()&#8221; instead of the &#8220;settimeout()&#8221; which will continue counting the time after every renewal.</p>
<p>I created this <strong>test environment</strong> that you may download <strong><a href="http://ricardo.parente.us/wp-content/downloads/code/sessionTimeoutAlert.zip" title="Session Timeout Alert" target="_blank">here</a></strong>.<br />
<span id="more-225"></span><br />
There are some scoped variables to use. I&#8217;m used to Fusebox, so I define them either in my &#8220;Application.cfc&#8221; or in my &#8220;fusebox.init.cfm&#8221;:<br />
<code>&lt;cfscript><br />
application.sessionTimeout = 10; // session timeout in seconds (we set it to 10 secs for this test)<br />
application.sessionTimeoutAlert = 5; //how many seconds before the timeout to send the alert<br />
application.sessionTimeoutUseAjax=true; //use Ajax or reload the page<br />
request.sessionTimeoutURL=&quot;index.cfm?fuseaction=home.logout&quot;; //URL to jump when client denies refreshing<br />
request.scriptDir = "scripts/"; //folder for the javascripts<br />
request.componentDir = "components/"; //folder for the components<br />
request.sessionRefreshFunction = "sessionRefresh"; //name of the function to call</code></p>
<p>Put the following code in the HEAD section:<br />
<code>&lt;cfif application.sessionTimeoutUseAjax><br />
&nbsp;&nbsp;&nbsp;&lt;script type=&#39;text/javascript&#39; src=&#39;#request.scriptDir#ajax/engine.js&#39;>&lt;/script><br />
&nbsp;&nbsp;&nbsp;&lt;script type=&#39;text/javascript&#39; src=&#39;#request.scriptDir#ajax/util.js&#39;>&lt;/script><br />
&nbsp;&nbsp;&nbsp;&lt;script type=&#39;text/javascript&#39; src=&#39;#request.scriptDir#ajax/settings.js&#39;>&lt;/script><br />
&lt;/cfif><br />
&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;><br />
var _cfscriptLocation = &quot;#replace(request.componentDir, &#39;.&#39;,&#39;/&#39;,&#39;all&#39;)#/ajaxFunctions.cfc&quot;;<br />
var sessionTimeoutAlert = #application.sessionTimeoutAlert#;<br />
var sessionTimeoutDays = 0;<br />
var sessionTimeoutHours = 0 + (sessionTimeoutDays *60);<br />
var sessionTimeoutMinutes = 0 + (sessionTimeoutHours *60);<br />
var sessionTimeoutSeconds = (#application.sessionTimeout# + (sessionTimeoutMinutes *60)) - sessionTimeoutAlert;<br />
var sessionTimeout = sessionTimeoutSeconds * 1000;<br />
setInterval(<br />
&nbsp;&nbsp;&nbsp;function() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(confirm(&#39;Your session will expire soon, do you want to continue? &#39;))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfif application.sessionTimeoutUseAjax><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWREngine._execute(_cfscriptLocation, null, &#39;sessionRefresh&#39;, &#39;true&#39;, sessionTimeoutResult);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfelse><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.location.href = window.location.href;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/cfif><br />
&nbsp;&nbsp;&nbsp;else windows.location.href=&#39;#request.sessionTimeoutURL#&#39;;<br />
&nbsp;&nbsp;&nbsp;},<br />
&nbsp;&nbsp;&nbsp;sessionTimeout<br />
);<br />
&lt;cfif application.sessionTimeoutUseAjax><br />
function sessionTimeoutResult(result){<br />
// do nothing<br />
}<br />
&lt;/cfif><br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2008/10/session-timeout-notice-using-javascript/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Moving Options to Other Select Object</title>
		<link>http://ricardo.parente.us/2008/10/moving-options-to-other-select-object/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=moving-options-to-other-select-object</link>
		<comments>http://ricardo.parente.us/2008/10/moving-options-to-other-select-object/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 19:10:47 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[multi-select]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=213</guid>
		<description><![CDATA[My friend Flavio asked me for a code to select some options from a select box and populate other that will be submitted with the form as the &#8220;chosen&#8221; options. I know that there are many forms to do that and there are on the web several tutorials using Javascript and extensions as jQuery, etc.  [...]]]></description>
			<content:encoded><![CDATA[<p>My friend Flavio asked me for a code to select some options from a select box and populate other that will be submitted with the form as the &#8220;chosen&#8221; options. I know that there are many forms to do that and there are on the web several tutorials using Javascript and extensions as jQuery, etc. </p>
<p>I wrote a simple javascript with ideas from what I have seen on the web and it came out working good. So the credits are not all mine.<br />
<strong>Download the code <a title="Download MoveSelectOptions" href="http://ricardo.parente.us/wp-content/downloads/code/moveSelectOptions.zip" target="_blank">here</a></strong></p>
<p><span id="more-213"></span></p>
<p>Here is the Javascript I called &#8220;moveSelectOptions.js&#8221;<code>/*<br />
By Ricardo Parente<br />
October 20, 2008<br />
rparente (at) cfdevelopers.net<br />
*/<br />
function moveIt(source,destination) {<br />
   var oSource = document.getElementById(source);<br />
   if (!hasOptions(oSource)) return;<br />
var oDestination = document.getElementById(destination);<br />
var aValue = new Array();<br />
var aText = new Array();<br />
for (var i=0; i&lt; oSource.options.length; i++) {<br />
if (oSource.options[i].selected) {<br />
oDestination.options[oDestination.options.length] = new Option(oSource.options[i].text, oSource.options[i].value);<br />
} <br />
}<br />
var x=0;<br />
for (i=0; i&lt; oSource.options.length; i++) {<br />
if (!oSource.options[i].selected) {<br />
aValue[x]=oSource.options[i].value;<br />
aText[x]=oSource.options[i].text;<br />
x++;<br />
}<br />
}<br />
oSource.options.length = 0;<br />
for (i=0; i&lt; x; i++) {<br />
oSource.options[i] = new Option(aText[i], aValue[i]);<br />
}<br />
}<br />
function selectAll(source) {<br />
var oSource = document.getElementById(source);<br />
if (!hasOptions(oSource)) return;<br />
for (var i=0; i &lt; oSource.options.length; i++) {<br />
oSource.options[i].selected = true;<br />
}<br />
}<br />
function hasOptions(obj) {<br />
if (obj!=null &amp;&amp; obj.options!=null) return true; <br />
return false;<br />
}<br />
</code><br />
Here is a form for testing the code: &#8220;moveSelectOptions.cfm&#8221;:<br />
Insert this javascript call in the head section:<br />
<code>&lt;script language="JavaScript" src="moveSelectOptions.js" type="text/javascript"&gt;&lt;/script&gt;</code><br />
Body section:<code>&lt;cfoutput&gt;<br />
&lt;cfif structkeyExists(form,"destination")&gt;<br />
&lt;cfdump var="#form#" /&gt;<br />
&lt;/cfif&gt;<br />
&lt;form name="myform" action="#cgi.script_name#" method="post" onsubmit="selectAll('destination');selectAll('source');"&gt;<br />
&lt;/cfoutput&gt;<br />
&lt;table&gt;<br />
&lt;tr&gt;<br />
&lt;td valign="top"&gt;From:<br />
&lt;td valign="top"&gt;<br />
&lt;select name="source" multiple size="5" style="width:150px;"&gt;<br />
&lt;option value="apples"&gt;Apples<br />
&lt;option value="oranges"&gt;Oranges<br />
&lt;option value="grapes"&gt;Grapes<br />
&lt;option value="tomatoes"&gt;Tomatoes<br />
&lt;option value="potatoes"&gt;Potatoes<br />
&lt;option value="pears"&gt;Pears<br />
&lt;/select&gt;<br />
&lt;/td&gt;<br />
&lt;td align="center" valign="top"&gt;<br />
&lt;input type="Button" value="&gt;&gt;" onclick="moveIt('source','destination');" /&gt;<br />
&lt;input type="Button" value="&lt;&lt;" onclick="moveIt('destination','source');" /&gt;<br />
&lt;input type="Button" value="All &gt;&gt;" onclick="selectAll('source');moveIt('source','destination');" /&gt;&lt;br/&gt;<br />
&lt;input type="Button" value="&lt;&lt; All" onclick="selectAll('destination');moveIt('destination','source');" /&gt;&lt;br/&gt;<br />
&lt;/td&gt;<br />
&lt;td valign="top"&gt;To:&lt;/td&gt;<br />
&lt;td valign="top"&gt;<br />
&lt;select name="destination" multiple size="5" style="width:150px;"&gt;<br />
&lt;/select&gt;<br />
&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td colspan="5" align="right"&gt;&lt;input type="Submit" value="Send" /&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;/form&gt;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2008/10/moving-options-to-other-select-object/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

