<?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>Thu, 10 May 2012 20:24:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Lookup data from a related entity (Lookup) using JScript and the XrmServiceToolkit</title>
		<link>http://mscrmblogger.com/2012/05/10/lookup-data-from-a-related-entity-lookup-using-jscript-and-the-xrmservicetoolkit/</link>
		<comments>http://mscrmblogger.com/2012/05/10/lookup-data-from-a-related-entity-lookup-using-jscript-and-the-xrmservicetoolkit/#comments</comments>
		<pubDate>Thu, 10 May 2012 20:22:56 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[API-SDK]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[CodePlex]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[CRM Online]]></category>
		<category><![CDATA[crm sdk]]></category>
		<category><![CDATA[crm2011]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[lookup]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Web Resource]]></category>
		<category><![CDATA[XrmServiceToolkit]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=1007</guid>
		<description><![CDATA[Lookup information from a related entity using the XrmServiceToolkit or just the REST endpoint.]]></description>
			<content:encoded><![CDATA[<p>Do you need the value from a related entity, like a lookup?  I had written this for CRM 4 a while back, and people use it, but I occasionally get questions about looking up other values in CRM.  This bit of code will help you find those values on a related object.  Below are two options to do this.  Option 1: using the REST SDK and JSON2, and then Option 2: using Jaimie Ji&#8217;s <a href="http://xrmservicetoolkit.codeplex.com/" target="_blank">XRM Service Toolkit</a>.</p>
<p>Jaimie Ji&#8217;s <a href="http://xrmservicetoolkit.codeplex.com/" target="_blank">XRM Service Toolkit</a> provides a comprehensive set of JScript libraries for interacting with the SOAP and REST SDK through JavaScript.  While Option 1 in this particular use case is fairly simple, when you start needing to do more advanced things, you may want to look at using that kit.  It is fairly comprehensive and he keeps it up to date.</p>
<h1>Option 1: Using the REST SDK and JSON2</h1>
<p>Using the REST SDK is great, and there are some really good examples in the CRM SDK help file.  Now in order to use the below code-block, you need to use JSON.</p>
<p>JSON, or JavaScript Object Notation, is a text format that is used to interchange data.  JSON2.js is a lightweight javascript that convert the strings to javascript objects and vice-versa.  The CRM REST SDK can return data in JSON format.</p>
<p>To get the code for JSON2, you can go <a href="https://github.com/douglascrockford/JSON-js" target="_blank">here</a>.  You will need to embed this code into your javascript file or include json2.js along with the code below.  Without it, you will not be able to parse the data properly, and the code below uses the JSON library in json2.js.</p>
<p>Ok, below we have 3 functions:</p>
<ul>
<li><b>getServerUrl</b> :  which gets the server URL &#8211; taken from the <a href="http://crmrestkit.codeplex.com/" target+"_blank">CrmRestKit</a></li>
<li><b>Lookup_Changed</b> : what you call when a lookup is changed</li>
<li><b>retrieveReqCallBack</b> : the callback function that performs any actions</li>
<li>
</li>
</ul>
<p>You would put Lookup_Changed in the change event of a lookup field and specify the attributes like one of the following:</p>
<ul>
<li>&#8216;contactid&#8217;,'Contact&#8217;,'contactlookup&#8217;</li>
<li>&#8216;contactid&#8217;,'Contact&#8217;,'contactlookup&#8217;,['Telephone1']</li>
<li>&#8216;contactid&#8217;,'Contact&#8217;,'contactlookup&#8217;,['Telephone1','FullName]</li>
</ul>
<p>Then you&#8217;d put your actions inside the retrieveReqCallBack.</p>
<pre name="code" class="javascript">
function getServerUrl() {
    // From CrmRestKit.js
    var localServerUrl = window.location.protocol + &quot;/&quot; + window.location.host;
    var context = parent.Xrm.Page.context;

    if (context.isOutlookClient() &amp;&amp; !context.isOutlookOnline()) {
        return localServerUrl;
    }
    else {
        var crmServerUrl = context.getServerUrl();
        crmServerUrl = crmServerUrl.replace(/^(http|https):\/\/([_a-zA-Z0-9\-\.]+)(:([0-9]{1,5}))?/, localServerUrl);
        crmServerUrl = crmServerUrl.replace(/\/$/, &quot;&quot;);
    }
    return crmServerUrl;
}

function Lookup_Changed(attributeName, entityName, callbackId, columns) {
    var serverUrl = Xrm.Page.context.getServerUrl();
    var ODataPath = serverUrl + &quot;/XRMServices/2011/OrganizationData.svc&quot;;

    var lookup = Xrm.Page.data.entity.attributes.get(attributeName).getValue();
    if (lookup===null) {
        return false;
    }

    var id = lookup[0].id;
    if (id == null) {
        return false;
    }

    var retrieveReq = new XMLHttpRequest();

    var url = ODataPath + &quot;/&quot;+entityName+&quot;Set(guid'&quot; + id + &quot;')&quot;;
    if (columns !== undefined &amp;&amp; columns !== null) {
        url = url + &quot;?$select=&quot; + columns.join(',');
    }

    retrieveReq.open(&quot;GET&quot;, url, true);
    retrieveReq.setRequestHeader(&quot;Accept&quot;, &quot;application/json&quot;);
    retrieveReq.setRequestHeader(&quot;Content-Type&quot;, &quot;application/json; charset=utf-8&quot;);
    retrieveReq.onreadystatechange = function () {
        if (this.readyState == 4 /* complete */) {
            if (this.status == 200) {
                var data;
                var jData;
                jData = JSON.parse(this.responseText);
                if (jData &amp;&amp; jData.d &amp;&amp; jData.d.results &amp;&amp; jData.d.results.length &gt; 0) {
                    data = jData.d.results[0];
                } else if (jData &amp;&amp; jData.d) {
                    data = jData.d;
                }

                if (data == null) {
                    return;
                }
                retrieveReqCallBack(callbackId, data);
            }
        }
    };
    retrieveReq.send();
    return true;
}

function retrieveReqCallBack(calltype, data) {
    var toLookup=function(data) {
        if (data==null || data==&quot;&quot; || (data.Id==null)) {
            return null;
        }

        var result=new Array();
        result[0] = {};
        result[0].id = data.Id;
        result[0].name = data.Name;
        result[0].entityType = data.LogicalName;
        return result;
    }

    switch (calltype) {
        case 'pricelookup':
            Xrm.Page.data.entity.attributes.get(&quot;new_pricecategorylookup&quot;).setValue(toLookup(c.new_pricecategorylookup);
            break;
        case 'contactlookup':
            Xrm.Page.data.entity.attributes.get(&quot;insp_poctelephonenumber&quot;).setValue(c.Telephone1);
            break;
        default:
            break;
    }
}
</pre>
<h1>Option 2: Using the XrmServiceToolkit with similar functions</h1>
<p>Ok, now let&#8217;s assume you are using the <a href="http://xrmservicetoolkit.codeplex.com/" target="_blank">XRM Service Toolkit</a>, and you want to do the same thing, using a Lookup_Changed function and the retrieveReqCallBack function.  Instead of embedding JSON and a method to get the server url, you can use the following:</p>
<pre name="code" class="javascript">
function Lookup_Changed(attributeName, entityName, callbackId, columns) {
    var lookup = Xrm.Page.data.entity.attributes.get(attributeName).getValue();
    if (lookup===null) {
        return false;
    }

    if (lookup[0].id == null) {
        return false;
    }

	XrmServiceToolkit.Rest.Retrieve(
        entityName,
        lookup[0].id,
        columns,
		null,
        function (result) {
            retrieveReqCallBack(callbackId, result);
        },
        function (error) {
            throw error;
        },
		true
    );
}

function retrieveReqCallBack(calltype, data) {
    var toLookup=function(data) {
        if (data==null || data==&quot;&quot; || (data.Id==null)) {
            return null;
        }

        var result=new Array();
        result[0] = {};
        result[0].id = data.Id;
        result[0].name = data.Name;
        result[0].entityType = data.LogicalName;
        return result;
    }

    switch (calltype) {
        case 'pricelookup':
            Xrm.Page.data.entity.attributes.get(&quot;new_pricecategorylookup&quot;).setValue(toLookup(c.new_pricecategorylookup);
            break;
        case 'contactlookup':
            Xrm.Page.data.entity.attributes.get(&quot;insp_poctelephonenumber&quot;).setValue(c.Telephone1);
            break;
        default:
            break;
    }
}
</pre>
<p>The <a href="http://xrmservicetoolkit.codeplex.com/" target="_blank">XRM Service Toolkit</a> does a lot, and I would suggest checking it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2012/05/10/lookup-data-from-a-related-entity-lookup-using-jscript-and-the-xrmservicetoolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing OptionSet Values on Yes/No Form Field Change</title>
		<link>http://mscrmblogger.com/2011/11/01/crm2011optionsetvalues/</link>
		<comments>http://mscrmblogger.com/2011/11/01/crm2011optionsetvalues/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 16:17:12 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[boolean]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[CRM Online]]></category>
		<category><![CDATA[crm2011]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[picklist]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Web Resource]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=870</guid>
		<description><![CDATA[<p>Recently someone posted a question about the article I had written for CRM 4 as an example.  Here is the 2011 version to hopefully help people find the proper information.</p>]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve received some questions on how to change the optionset (previously called picklist) values in CRM 2011 the same way I did in my <a href="http://mscrmblogger.com/2009/10/03/changing-picklist-values-on-yesno-form-field-change/">previous CRM 4 post</a> about using the OnChange event of a yes/no field to change the values of a picklist.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/gg334266.aspx">This technet page shows the methods available for the different types of controls.</a></p>
<p><strong>Here is an example of how to change the optionset based on a yes/no field:</strong></p>
<pre name="code" class="javascript">
function BuildOptionSet(picklist, valuelist)
{
	picklist.clearOptions();
	for(var i=0; i&lt;valuelist.length; i++)
	{
		var listitem = valuelist[i];
		picklist.addOption(listitem[0], listitem[1]);
	}
}

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

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

var uselista = Xrm.Page.data.entity.attributes.get("YesNo").getValue();
var optionset = Xrm.Page.ui.controls.get("OptionSet");

if (uselista==true) {
   BuildOptionSet(optionset, lista);
} else {
   BuildOptionSet(optionset, listb);
}
</pre>
<p>You just need to change the values of lista and listb and the YesNo and OptionSet lines to reflect the fields on your form, and add it to the onchange event of the dropdown Yes/No form field.</p>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/11/01/crm2011optionsetvalues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CRM 2011: Toggle Visibility (Hide/Show) &#8211; Visibility.js</title>
		<link>http://mscrmblogger.com/2011/02/24/crm-2011-toggle-visibility/</link>
		<comments>http://mscrmblogger.com/2011/02/24/crm-2011-toggle-visibility/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 22:57:49 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[onload event]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[toggle field]]></category>
		<category><![CDATA[visibility]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=314</guid>
		<description><![CDATA[Visibility.js provides a simple way to set the visibility of navigation, section, tab, and form control elements using JScript.  It also allows you to change the visibility using the onClick event of a checkbox.]]></description>
			<content:encoded><![CDATA[<p>Often times we need to toggle the visiblity of an element based on the value of a field.  This JScript file adds the methods to accomplish this by calling the setVisibility function.  For example, in an onChange event for new_mypicklist I can call:</p>
<pre name="code" class="javascript">
setVisibility('section','new_mypicklist','section_main',42);
</pre>
<p>This hides the section_main section if the value is not 42, which simplifies the process of hiding and showing relevant information.</p>
<p>I also like to use checkboxes to handle the visibility of elements, but checkbox values dont&#8217; change until they lose focus.  To work around the issue, I register an onClick event during the form load instead of using the onChange event.  This unsupported method allows me to modify the value onClick and change the visibility immediately.  To use this I just need to call it in the onload:</p>
<pre name="code" class="javascript">
registerToggle('section', 'new_checkbox', 'section_main');
</pre>
<p>If you wanted to hide it when new_checkbox was false (or no), then you would need to specify the value, 0.</p>
<pre name="code" class="javascript">
registerToggle('section', 'new_checkbox', 'section_main',0);
</pre>
<p><b>JScript: visibility.js</b></p>
<p>This is the main javascript file&#8230; visibility.js that you would need to add and reference as a web resource in CRM 2011, everything except for the registerToggle uses supported methods.</p>
<pre name="code" class="javascript">
function registerToggle(t, attr, c, v) {
    if (typeof (v) === &quot;undefined&quot; || v === null) {
        var v = 1;
    }
    var ctrl = Xrm.Page.ui.controls.get(attr);
    var a = ctrl.getAttribute();
    var el = document.getElementById(attr);

    // Build Toggle Function
    var f = &quot;var ef=function() { &quot; +
              &quot;var a = Xrm.Page.data.entity.attributes.get(attr); &quot; +
              &quot;a.setValue(!a.getValue()); &quot; +
              &quot;setVisibility('&quot; + t + &quot;','&quot; + attr + &quot;','&quot; + c + &quot;',&quot; + v + &quot;);&quot; +
              &quot; };&quot;&#59;

    eval(f);

    // Attach to click event
    el.attachEvent('onclick', ef, false);

    // Set visibility
    setVisibility(t, attr, c, v);
}

function setVisibility(t, attr, c, v) {
    switch (t.toLowerCase().charAt(0)) {
        //tab
        case 't': setTabVisibility(attr, c, v);
            break;
        //section
        case 's': setSectionVisibility(attr, c, v);
            break;
        //control
        case 'c': setControlVisibility(attr, c, v);
            break;
        //navigation
        case 'n': setNavigationVisibility(attr, c, v);
            break;
    }
}

function setNavigationVisibility(attributename, navitemname, value) {
    var attribute = Xrm.Page.data.entity.attributes.get(attributename);
    var navitem = Xrm.Page.ui.navigation.items.get(navitemname);
    if (navitem === null)
    {
        return;
    }
    navitem.setVisible(attribute.getValue() == value);
}

function setTabVisibility(attributename, tabname, value) {
    var attribute = Xrm.Page.data.entity.attributes.get(attributename);
    var tab = Xrm.Page.ui.tabs.get(tabname);
    if (tab === null)
    {
        return;
    }
    tab.setVisible(attribute.getValue() == value);
}

function setSectionVisibility(attributename, sectionname, value) {
    var attribute = Xrm.Page.data.entity.attributes.get(attributename);
    var tabs = Xrm.Page.ui.tabs.get();
    for(var i in tabs) {
        var tab = tabs[i];
        var section = tab.sections.get(sectionname);
        if (section !== null) {
            section.setVisible(attribute.getValue() == value);
            return;
        }
    }
}

function setControlVisibility(attributename, controlname, value) {
    var attribute = Xrm.Page.data.entity.attributes.get(attributename);
    var control = Xrm.Page.ui.controls.get(controlname);
    if (control === null)
    {
        return;
    }
    control.setVisible(attribute.getValue() == value);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/02/24/crm-2011-toggle-visibility/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>CRM Common JScript 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 JScript 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>
<p><i>CRM 2011 uses web-resources which can be a common JScript file.</i></p>
]]></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[Extensions]]></category>
		<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><i>This article was written for CRM 4.  If you are interested in seeing how this would be done in CRM 2011, please click <a href="http://mscrmblogger.com/2011/11/01/crm2011optionsetvalues/">here</a>.</i></p>
<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>2</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[Extensions]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></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>

