<?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>MSCRM Blogger &#187; onchange</title>
	<atom:link href="http://mscrmblogger.com/tag/onchange/feed/" rel="self" type="application/rss+xml" />
	<link>http://mscrmblogger.com</link>
	<description>Achieving it all with Microsoft Dynamics CRM™</description>
	<lastBuildDate>Fri, 09 Jul 2010 14:57:43 +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>CRM Common Javascript File</title>
		<link>http://mscrmblogger.com/2009/10/13/crm-common-javascript-file/</link>
		<comments>http://mscrmblogger.com/2009/10/13/crm-common-javascript-file/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 21:10:46 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 4]]></category>
		<category><![CDATA[crm4]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics CRM 4]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[onload event]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=186</guid>
		<description><![CDATA[Need to reference an external javascript file to make functions available in change events and in an onload?  Here's how!]]></description>
			<content:encoded><![CDATA[<p>I use a lot of the same function on multiple pages, and I think a lot of you do to.  You can create a common javascript file and load it during an onload event, extending the functionality of your CRM.  This is particularly useful because it reduces the amount of changes you have to make when you want to change how something works.</p>
<p>Code reuse is important, and I believe in creating libraries and using libraries. Javascript files are libraries, and they are cached.  So if you update a Javascript file you are loading this way, make sure your users clear their cache.</p>
<pre name="code" class="javascript">
function loadjs(filename, onload){
  var scriptfile=document.createElement('script');
  scriptfile.setAttribute("type","text/javascript");
  scriptfile.setAttribute("src", filename);
  scriptfile.onreadystatechange=onload;
  document.getElementsByTagName("head")[0].appendChild(scriptfile);
}

loadjs("/MoreJavascript/tools.js", function(){
	if (this.readyState == 'loaded' || this.readyState == 'complete') {
		FunctionInJavascriptFile();
		this.onreadystatechanged=null;
	}
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2009/10/13/crm-common-javascript-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing PickList Values on Yes/No Form Field Change</title>
		<link>http://mscrmblogger.com/2009/10/03/changing-picklist-values-on-yesno-form-field-change/</link>
		<comments>http://mscrmblogger.com/2009/10/03/changing-picklist-values-on-yesno-form-field-change/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 02:32:02 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[boolean]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 4]]></category>
		<category><![CDATA[crm4]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics CRM 4]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[picklist]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=156</guid>
		<description><![CDATA[<p>Recently on the Microsoft forums someone asked how to change the values of a picklist based on the yes no value of a boolean field.  Just add this script to the OnChange event of the yes/no field.</p>]]></description>
			<content:encoded><![CDATA[<p>Recently on the Microsoft forums someone asked how to change the values of a picklist based on the yes no value of a boolean field.  Just add this script to the OnChange event of the yes/no field.</p>
<p><a href="http://technet.microsoft.com/en-us/library/aa681845.aspx">This technet page shows some of the functions on different form fields.</a></p>
<p><strong>Here is an example of how to change the picklist based on a yes/no field:</strong></p>
<pre name="code" class="javascript">
function CreatePicklistValue(Name,Value)
{
	var retval = new Array();
	retval[0]  = Name;
	retval[1]  = Value;
	return retval;
}

function BuildPickList(picklist, valuelist)
{
	var options = picklist.Options;
	for(var i=0; i&lt;options.length; i++)
	{
		var option = options[i];
		picklist.DeleteOption(option.DataValue);
	}
	for(var j=0; j&lt;valuelist.length; j++)
	{
		var listitem = valuelist[j];
		picklist.AddOption(listitem[0], listitem[1]);
	}
}

var lista = new Array();
lista[0] = CreatePicklistValue('Alpha',0);
lista[1] = CreatePicklistValue('Beta',1);

var listb = new Array();
listb[0] = CreatePicklistValue('Charlie',2);
listb[1] = CreatePicklistValue('Delta',3);

var uselista = crmForm.all.YesNo.DataValue;
var picklist = crmForm.all.Picklist;

if (uselista==true) {
   BuildPickList(picklist, lista);
} else {
   BuildPickList(picklist, listb);
}
</pre>
<p>You just need to change the values of lista and listb, and the crmForm.all.YesNo and crmForm.all.Picklist.</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2009/10/03/changing-picklist-values-on-yesno-form-field-change/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove special characters on value change.</title>
		<link>http://mscrmblogger.com/2009/10/01/remove-special-characters-on-value-change/</link>
		<comments>http://mscrmblogger.com/2009/10/01/remove-special-characters-on-value-change/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 15:02:21 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[crm4]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics CRM 4]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=150</guid>
		<description><![CDATA[This blog entry contains some helpful information about removing special characters from a string using javascript.  I was able to modify it to be just a few  of code in an onchange event.  Just rename new_name to the attribute your correcting.

if (crmForm.all.new_name.DataValue &#038;&#038; crmForm.all.new_name.DataValue.length >0)
{
crmForm.all.new_name.DataValue = crmForm.all.new_name.DataValue.replace(/[^a-zA-Z 0-9]+/g,'');
}

]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/">This blog entry</a> contains some helpful information about removing special characters from a string using javascript.  I was able to modify it to be just a few  of code in an onchange event.  Just rename new_name to the attribute your correcting.</p>
<pre name="code" class="javascript">
if (crmForm.all.new_name.DataValue &#038;&#038; crmForm.all.new_name.DataValue.length >0)
{
crmForm.all.new_name.DataValue = crmForm.all.new_name.DataValue.replace(/[^a-zA-Z 0-9]+/g,'');
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2009/10/01/remove-special-characters-on-value-change/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
