<?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; state</title>
	<atom:link href="http://mscrmblogger.com/tag/state/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>CRM 2011: Making the state field a drop down</title>
		<link>http://mscrmblogger.com/2011/05/11/crm-2011-making-the-state-field-a-drop-down/</link>
		<comments>http://mscrmblogger.com/2011/05/11/crm-2011-making-the-state-field-a-drop-down/#comments</comments>
		<pubDate>Wed, 11 May 2011 16:08:12 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[crm 2011]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[editable dropdown]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[microsoft dynamics crm]]></category>
		<category><![CDATA[Microsoft Dynamics CRM 2011]]></category>
		<category><![CDATA[state]]></category>
		<category><![CDATA[stateorprovince]]></category>
		<category><![CDATA[Web Resource]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=456</guid>
		<description><![CDATA[<p><b>Do you want a drop down box for the state, but you don't want to break core CRM functionality?</b></p>
<p>In CRM 4.0 I had posted an article about <a href="http://mscrmblogger.com/2009/05/11/change-crm-address-state-to-a-drop-down-box/">changing the CRM Address State to a drop down box</a>.  I had modified the script to work with CRM 2011, but it was still unsupported and some people had problems making it work on other entities.  This version uses an HTML web resource and uses all supported methods.</p>]]></description>
			<content:encoded><![CDATA[<p><b>Do you want a drop down box for the state, but you don&#8217;t want to break core CRM functionality?</b></p>
<p>In CRM 4.0 I had posted an article about <a href="http://mscrmblogger.com/2009/05/11/change-crm-address-state-to-a-drop-down-box/">changing the CRM Address State to a drop down box</a>.  While I had gone back and updated the code to work with CRM 2011, some people still had problems using it.  Also, it wasn&#8217;t the best way to do it in CRM 2011.  With the web-resources in CRM 2011 there is a completely supported way of creating a state drop down!</p>
<p>You can use an html web-resource!  Below is the source for the html web resource, then you just need to hide the state drop down on your form and add the web resource and set the data parameter to the field id, such as address1_stateorprovince.</p>
<p>This helps by providing a set of default option in a drop-down box.  It also supports (** Other) which will show a text box for entering something not in the drop down.  This web-resource works on any entity where you need a state drop down.</p>
<p><b>Here is the configuration for the HTML Web Resource on the Contact form:</b></p>
<div id="attachment_473" class="wp-caption aligncenter" style="width: 794px"><a href="http://mscrmblogger.com/wp-content/uploads/2011/05/statedropdown-resource-properties.png"><img src="http://mscrmblogger.com/wp-content/uploads/2011/05/statedropdown-resource-properties.png" alt="State Drop Down Web Resource Properties" title="State Drop Down Web Resource Properties" width="784" height="597" class="size-full wp-image-473" /></a><p class="wp-caption-text">State Drop Down Web Resource Properties</p></div>
<p><b>StateDropDown.html:</b></p>
<pre name="code" class="html">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;State Drop Down&lt;/title&gt;
&lt;link href=&quot;/_common/styles/fonts.css.aspx?lcid=1033&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
&lt;link href=&quot;/_common/styles/global.css.aspx?lcid=1033&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
&lt;link href=&quot;/_common/styles/select.css.aspx?lcid=1033&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
var datafield;
function getQuerystring(key)
{
    var work = key.replace(/[\[]/,&quot;\\\[&quot;).replace(/[\]]/,&quot;\\\]&quot;);
    var regex = new RegExp(&quot;[\\?&amp;]&quot;+work+&quot;=([^&amp;#]*)&quot;);
    var qs = regex.exec(window.location.href);
    if (qs == null) return null;
    return qs[1];
}

function onLoad()
{
    var updatefield = getQuerystring(&quot;data&quot;);
    if (top.location.href.indexOf(&quot;/print/print.aspx&quot;) != -1)
    {
        // While this part of the onload is unsupported, there is not another way to do it
        // because Xrm.Page.data.entity is not supported in print-preview
        var data_cell = document.getElementById(&quot;cell_dd&quot;);
        var crmField = top.frames[0].document.getElementById(updatefield+&quot;_d&quot;);
        data_cell.innerHTML = crmField.innerHTML;
        return;
    }
    datafield = parent.Xrm.Page.data.entity.attributes.get(updatefield);
    var value = datafield.getValue();
    var dropdown = document.getElementById(&quot;custom_state&quot;);

    // fix for outlook issue identified by Ryan
    // do not pass null value to IsOptionInDropDown
    if (value==null || value==&quot;&quot;) {
        dropdown.value = &quot;!1&quot;; // Set to select a state by default
        return; // stop processing - empty value
    }

    // If it is a dropdown value, set the dropdown and exit onload
    if (IsOptionInDropDown(value)) return;

    // no value found for drop down, value is not null or empty, therefor set other
    dropdown.value = &quot;other&quot;;
    var other = document.getElementById(&quot;other_state&quot;);
    other.value = value;
    SetOtherVisible(true);
}

function IsOptionInDropDown(value)
{
    // Replace fixes for common name variants
    switch (value) {
        case "d.c.": value="dc";
            break;
        default:
            break;
    }

    // Change to lowercase
    var lvalue=value.toLowerCase();

    var dropdown = document.getElementById("custom_state");
    var options = dropdown.options;
    var i = 0;
    for(i=0;i&lt;options .length;i++)
    {
        if (options[i].value.toLowerCase() == lvalue || options[i].text.toLowerCase() == lvalue)
        {
            dropdown.value = options[i].value;
            SetOtherVisible(false);
            return true;
        }
    }
    return false;
}

function DropDownChanged(value)
{
    if (value !== null &amp;&amp; value!==&quot;&quot;) {
        if (value.charAt(0)=='!') { // Fixed By Joseph Martine - charAt or substring not [0]
            StateChanged(&quot;&quot;);// Fixed By Joseph Martine
            return;
        }
        if (value==&quot;other&quot;) {
            SetOtherVisible(true);
            return;
        } else {
            SetOtherVisible(false); // Fixed By Joseph Martine
        }
        var os = document.getElementById(&quot;other_state&quot;);
        os.value = value;
        StateChanged(value);
    }
}

function TextBoxChanged(value)
{
    StateChanged(value);
    IsOptionInDropDown(value); // This also updates the visible in its check...
    return true;
}

function StateChanged(value)
{
    // Update Xrm.Page data field
    datafield.setValue(value);
}

function SetOtherVisible(visibility)
{
    var ddcell = document.getElementById(&quot;cell_dd&quot;);
    var textcell = document.getElementById(&quot;cell_tb&quot;);
    if (visibility) {
        ddcell.style.width=&quot;50%&quot;;
        textcell.style.display=&quot;table-cell&quot;;
        textcell.style.width=&quot;50%&quot;;
    } else {
        textcell.style.display=&quot;none&quot;;
        ddcell.style.width=&quot;100%&quot;;
        textcell.style.width=&quot;100%&quot;;
    }
}

&lt;/script&gt;
&lt;/head&gt;
&lt;body onload=&quot;onLoad();&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;td id=&quot;cell_dd&quot;&gt;
&lt;select name=&quot;custom_state&quot; req=&quot;2&quot; height=&quot;4&quot; style=&quot;IME-MODE: auto;width:100%;&quot;
class=&quot;ms-crm-SelectBox&quot; id=&quot;custom_state&quot; onChange=&quot;DropDownChanged(this.value)&quot;&gt;
    &lt;option value=&quot;!1&quot;&gt;---Select a State-------&lt;/option&gt;
    &lt;option value=&quot;!2&quot;&gt;---Canada---------------&lt;/option&gt;
    &lt;option value=&quot;AB&quot;&gt;Alberta&lt;/option&gt;
    &lt;option value=&quot;BC&quot;&gt;British Columbia&lt;/option&gt;
    &lt;option value=&quot;MB&quot;&gt;Manitoba&lt;/option&gt;
    &lt;option value=&quot;NB&quot;&gt;New Brunswick&lt;/option&gt;
    &lt;option value=&quot;NL&quot;&gt;Newfoundland and Labrador&lt;/option&gt;
    &lt;option value=&quot;NT&quot;&gt;Northwest Territories&lt;/option&gt;
    &lt;option value=&quot;NS&quot;&gt;Nova Scotia&lt;/option&gt;
    &lt;option value=&quot;NU&quot;&gt;Nunavut&lt;/option&gt;
    &lt;option value=&quot;ON&quot;&gt;Ontario&lt;/option&gt;
    &lt;option value=&quot;PE&quot;&gt;Prince Edward Island&lt;/option&gt;
    &lt;option value=&quot;QC&quot;&gt;Quebec&lt;/option&gt;
    &lt;option value=&quot;SK&quot;&gt;Saskatchewan&lt;/option&gt;
    &lt;option value=&quot;YT&quot;&gt;Yukon&lt;/option&gt;
  &lt;option value=&quot;!3&quot;&gt;---United States--------&lt;/option&gt;
    &lt;option value=&quot;AL&quot;&gt;Alabama&lt;/option&gt;
    &lt;option value=&quot;AK&quot;&gt;Alaska&lt;/option&gt;
    &lt;option value=&quot;AZ&quot;&gt;Arizona&lt;/option&gt;
    &lt;option value=&quot;AR&quot;&gt;Arkansas&lt;/option&gt;
    &lt;option value=&quot;CA&quot;&gt;California&lt;/option&gt;
    &lt;option value=&quot;CO&quot;&gt;Colorado&lt;/option&gt;
    &lt;option value=&quot;CT&quot;&gt;Connecticut&lt;/option&gt;
    &lt;option value=&quot;DC&quot;&gt;District of Columbia&lt;/option&gt;
    &lt;option value=&quot;DE&quot;&gt;Delaware&lt;/option&gt;
    &lt;option value=&quot;FL&quot;&gt;Florida&lt;/option&gt;
    &lt;option value=&quot;GA&quot;&gt;Georgia&lt;/option&gt;
    &lt;option value=&quot;HI&quot;&gt;Hawaii&lt;/option&gt;
    &lt;option value=&quot;ID&quot;&gt;Idaho&lt;/option&gt;
    &lt;option value=&quot;IL&quot;&gt;Illinois&lt;/option&gt;
    &lt;option value=&quot;IN&quot;&gt;Indiana&lt;/option&gt;
    &lt;option value=&quot;IA&quot;&gt;Iowa&lt;/option&gt;
    &lt;option value=&quot;KS&quot;&gt;Kansas&lt;/option&gt;
    &lt;option value=&quot;KY&quot;&gt;Kentucky&lt;/option&gt;
    &lt;option value=&quot;LA&quot;&gt;Louisiana&lt;/option&gt;
    &lt;option value=&quot;ME&quot;&gt;Maine&lt;/option&gt;
    &lt;option value=&quot;MD&quot;&gt;Maryland&lt;/option&gt;
    &lt;option value=&quot;MA&quot;&gt;Massachusetts&lt;/option&gt;
    &lt;option value=&quot;MI&quot;&gt;Michigan&lt;/option&gt;
    &lt;option value=&quot;MN&quot;&gt;Minnesota&lt;/option&gt;
    &lt;option value=&quot;MS&quot;&gt;Mississippi&lt;/option&gt;
    &lt;option value=&quot;MO&quot;&gt;Missouri&lt;/option&gt;
    &lt;option value=&quot;MT&quot;&gt;Montana&lt;/option&gt;
    &lt;option value=&quot;NE&quot;&gt;Nebraska&lt;/option&gt;
    &lt;option value=&quot;NV&quot;&gt;Nevada&lt;/option&gt;
    &lt;option value=&quot;NH&quot;&gt;New Hampshire&lt;/option&gt;
    &lt;option value=&quot;NJ&quot;&gt;New Jersey&lt;/option&gt;
    &lt;option value=&quot;NM&quot;&gt;New Mexico&lt;/option&gt;
    &lt;option value=&quot;NY&quot;&gt;New York&lt;/option&gt;
    &lt;option value=&quot;NC&quot;&gt;North Carolina&lt;/option&gt;
    &lt;option value=&quot;ND&quot;&gt;North Dakota&lt;/option&gt;
    &lt;option value=&quot;OH&quot;&gt;Ohio&lt;/option&gt;
    &lt;option value=&quot;OK&quot;&gt;Oklahoma&lt;/option&gt;
    &lt;option value=&quot;OR&quot;&gt;Oregon&lt;/option&gt;
    &lt;option value=&quot;PA&quot;&gt;Pennsylvania&lt;/option&gt;
    &lt;option value=&quot;RI&quot;&gt;Rhode Island&lt;/option&gt;
    &lt;option value=&quot;SC&quot;&gt;South Carolina&lt;/option&gt;
    &lt;option value=&quot;SD&quot;&gt;South Dakota&lt;/option&gt;
    &lt;option value=&quot;TN&quot;&gt;Tennessee&lt;/option&gt;
    &lt;option value=&quot;TX&quot;&gt;Texas&lt;/option&gt;
    &lt;option value=&quot;UT&quot;&gt;Utah&lt;/option&gt;
    &lt;option value=&quot;VT&quot;&gt;Vermont&lt;/option&gt;
    &lt;option value=&quot;VA&quot;&gt;Virginia&lt;/option&gt;
    &lt;option value=&quot;WA&quot;&gt;Washington&lt;/option&gt;
    &lt;option value=&quot;WV&quot;&gt;West Virginia&lt;/option&gt;
    &lt;option value=&quot;WI&quot;&gt;Wisconsin&lt;/option&gt;
    &lt;option value=&quot;WY&quot;&gt;Wyoming&lt;/option&gt;
    &lt;option value=&quot;other&quot;&gt;** Other&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;&lt;td id=&quot;cell_tb&quot; style=&quot;padding-left:15px;display:none;&quot;&gt;
&lt;input class=&quot;ms-crm-Text&quot; style=&quot;ime-mode: auto;width:100%;&quot; type=&quot;text&quot;
maxLength=&quot;50&quot; id=&quot;other_state&quot; req=&quot;0&quot; onChange=&quot;TextBoxChanged(this.value);&quot; /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2011/05/11/crm-2011-making-the-state-field-a-drop-down/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>CRM 4: Change CRM Address State to a drop down box.</title>
		<link>http://mscrmblogger.com/2009/05/11/change-crm-address-state-to-a-drop-down-box/</link>
		<comments>http://mscrmblogger.com/2009/05/11/change-crm-address-state-to-a-drop-down-box/#comments</comments>
		<pubDate>Tue, 12 May 2009 01:35:21 +0000</pubDate>
		<dc:creator>Carlton Colter</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Web Resources]]></category>
		<category><![CDATA[account]]></category>
		<category><![CDATA[address]]></category>
		<category><![CDATA[contact]]></category>
		<category><![CDATA[core]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[crm4]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jscript]]></category>
		<category><![CDATA[lead]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[state]]></category>

		<guid isPermaLink="false">http://mscrmblogger.com/?p=47</guid>
		<description><![CDATA[Do you want a drop down box for the state, but you don't want to break core CRM functionality?  This little onload script will show the states for the United States and Canada (You can always modify it to have more options).  This will help restrict what people put in the state field by providing them a drop down box.  It will also allow them to view the old text box and enter any custom information just by clicking on '* ENTER A CUSTOM PROVINCE *'.]]></description>
			<content:encoded><![CDATA[<p><b>Do you want a drop down box for the state, but you don&#8217;t want to break core CRM functionality?</b></p>
<p>Ok.  This little onload script will show the states for the United States and Canada (You can always modify it to have more options).  This will help restrict what people put in the state field by providing them a drop down box.  It will also allow them to view the old text box and enter any custom information just by clicking on &#8216;* ENTER A CUSTOM PROVINCE *&#8217;.</p>
<p>This script will work on the onload for a lead, contact, account, and sales-contact.</p>
<p><i>Please post a comment and let me know what you think!</i></p>
<p>If you&#8217;re a consultant and you use this, please at least give us credit and provide the customer with the web address to our blog.</p>
<p><b>Onload Jscript Code:</b></p>
<pre name="code" class="javascript">
function ddlState ()
{

	// Get the state or province cell.
	var provinceid = 'stateorprovince';
	var statecell = document.getElementById(provinceid + '_d');

	if (!statecell)
	{
		provinceid = 'address1_stateorprovince';
		statecell = document.getElementById(provinceid + '_d');
	}

	var stateobject = document.getElementById(provinceid);
	stateobject.style.display = 'none';

	var statevalue = stateobject.value;

	var ddl = document.createElement('select');
	ddl.setAttribute('id','new_stateorprovince');
	ddl.setAttribute('class','ms-crm-SelectBox');
	ddl.setAttribute('req','2');
	ddl.setAttribute('height','4');
	ddl.setAttribute('style','IME-MODE: auto');

	// Build some lists.
	var CStateName = new Array();
	var CStateAbbr = new Array();
	var USStateName = new Array();
	var USStateAbbr = new Array();

	// If nothing is entered for state, show SELECT A STATE
	var found=false;
	if (statevalue.length&lt;1)
	{
		stateoption=document.createElement('option');
		stateoption.setAttribute('value','');
		stateoption.innerHTML = ' ** SELECT A STATE ** ';
		ddl.appendChild(stateoption);
		found=true;
	}

	// Build Canada Array
	CStateName[0]  = "Alberta";                   CStateAbbr[0]  = "AB";
	CStateName[1]  = "British Columbia";          CStateAbbr[1]  = "BC";
	CStateName[2]  = "Manitoba";                  CStateAbbr[2]  = "MB";
	CStateName[3]  = "New Brunswick";             CStateAbbr[3]  = "NB";
	CStateName[4]  = "Newfoundland and Labrador"; CStateAbbr[4]  = "NL";
	CStateName[5]  = "Northwest Territories";     CStateAbbr[5]  = "NT";
	CStateName[6]  = "Nova Scotia";               CStateAbbr[6]  = "NS";
	CStateName[7]  = "Nunavut";                   CStateAbbr[7]  = "NU";
	CStateName[8]  = "Ontario";                   CStateAbbr[8]  = "ON";
	CStateName[9]  = "Prince Edward Island";      CStateAbbr[9]  = "PE";
	CStateName[10] = "Quebec";                    CStateAbbr[10] = "QC";
	CStateName[11] = "Saskatchewan";              CStateAbbr[11] = "SK";
	CStateName[12] = "Yukon";                     CStateAbbr[12] = "YT";

	// Build US Array
	USStateName[0]  = "Alabama";        USStateAbbr[0]  = "AL";
	USStateName[1]  = "Alaska";         USStateAbbr[1]  = "AK";
	USStateName[2]  = "Arizona";        USStateAbbr[2]  = "AZ";
	USStateName[3]  = "Arkansas";       USStateAbbr[3]  = "AR";
	USStateName[4]  = "California";     USStateAbbr[4]  = "CA";
	USStateName[5]  = "Colorado";       USStateAbbr[5]  = "CO";
	USStateName[6]  = "Connecticut";    USStateAbbr[6]  = "CT";
	USStateName[7]  = "District of Columbia"; USStateAbbr[7]  = "DC";
	USStateName[8]  = "Delaware";       USStateAbbr[8]  = "DE";
	USStateName[9]  = "Florida";        USStateAbbr[9]  = "FL";
	USStateName[10]  = "Georgia";       USStateAbbr[10]  = "GA";
	USStateName[11] = "Hawaii";         USStateAbbr[11] = "HI";
	USStateName[12] = "Idaho";          USStateAbbr[12] = "ID";
	USStateName[13] = "Illinois";       USStateAbbr[13] = "IL";
	USStateName[14] = "Indiana";        USStateAbbr[14] = "IN";
	USStateName[15] = "Iowa";           USStateAbbr[15] = "IA";
	USStateName[16] = "Kansas";         USStateAbbr[16] = "KS";
	USStateName[17] = "Kentucky";       USStateAbbr[17] = "KY";
	USStateName[18] = "Louisiana";      USStateAbbr[18] = "LA";
	USStateName[19] = "Maine";          USStateAbbr[19] = "ME";
	USStateName[20] = "Maryland";       USStateAbbr[20] = "MD";
	USStateName[21] = "Massachusetts";  USStateAbbr[21] = "MA";
	USStateName[22] = "Michigan";       USStateAbbr[22] = "MI";
	USStateName[23] = "Minnesota";      USStateAbbr[23] = "MN";
	USStateName[24] = "Mississippi";    USStateAbbr[24] = "MS";
	USStateName[25] = "Missouri";       USStateAbbr[25] = "MO";
	USStateName[26] = "Montana";        USStateAbbr[26] = "MT";
	USStateName[27] = "Nebraska";       USStateAbbr[27] = "NE";
	USStateName[28] = "Nevada";         USStateAbbr[28] = "NV";
	USStateName[29] = "New Hampshire";  USStateAbbr[29] = "NH";
	USStateName[30] = "New Jersey";     USStateAbbr[30] = "NJ";
	USStateName[31] = "New Mexico";     USStateAbbr[31] = "NM";
	USStateName[32] = "New York";       USStateAbbr[32] = "NY";
	USStateName[33] = "North Carolina"; USStateAbbr[33] = "NC";
	USStateName[34] = "North Dakota";   USStateAbbr[34] = "ND";
	USStateName[35] = "Ohio";           USStateAbbr[35] = "OH";
	USStateName[36] = "Oklahoma";       USStateAbbr[36] = "OK";
	USStateName[37] = "Oregon";         USStateAbbr[37] = "OR";
	USStateName[38] = "Pennsylvania";   USStateAbbr[38] = "PA";
	USStateName[39] = "Rhode Island";   USStateAbbr[39] = "RI";
	USStateName[40] = "South Carolina"; USStateAbbr[40] = "SC";
	USStateName[41] = "South Dakota";   USStateAbbr[41] = "SD";
	USStateName[42] = "Tennessee";      USStateAbbr[42] = "TN";
	USStateName[43] = "Texas";          USStateAbbr[43] = "TX";
	USStateName[44] = "Utah";           USStateAbbr[44] = "UT";
	USStateName[45] = "Vermont";        USStateAbbr[45] = "VT";
	USStateName[46] = "Virginia";       USStateAbbr[46] = "VA";
	USStateName[47] = "Washington";     USStateAbbr[47] = "WA";
	USStateName[48] = "West Virginia";  USStateAbbr[48] = "WV";
	USStateName[49] = "Wisconsin";      USStateAbbr[49] = "WI";
	USStateName[50] = "Wyoming";        USStateAbbr[50] = "WY";

	// Build the drop down
	var stateoption;
	stateoption=document.createElement('option');
	stateoption.setAttribute('value','');
	stateoption.innerHTML = '---United States--------';
	ddl.appendChild(stateoption);

	var i=0;
	for(i=0;i&lt;USStateName.length;i++)
	{
		stateoption=document.createElement('option');
		stateoption.setAttribute('value',USStateAbbr[i]);
		if (USStateAbbr[i]==statevalue)
		{
			stateoption.setAttribute('selected','selected');
			found = true;
		}
		stateoption.innerHTML = USStateAbbr[i] +
		' (' + USStateName[i] + ')';
		ddl.appendChild(stateoption);
	}

	stateoption=document.createElement('option');
	stateoption.setAttribute('value','');
	stateoption.innerHTML = '---Canada---------------';
	ddl.appendChild(stateoption);

	var i=0;
	for(i=0;i&lt;CStateName.length;i++)
	{
		stateoption=document.createElement('option');
		stateoption.setAttribute('value',CStateAbbr[i]);
		if (CStateAbbr[i]==statevalue)
		{
			stateoption.setAttribute('selected','selected');
			found = true;
		}
		stateoption.innerHTML = CStateAbbr[i] + ' (' + CStateName[i] + ')';
		ddl.appendChild(stateoption);
	}

	stateoption=document.createElement('option');
	stateoption.setAttribute('value','customselection');
	stateoption.innerHTML = ' ** ENTER A CUSTOM PROVINCE ** ';

	if (found==false)
	{
		stateoption=document.createElement('option');
		stateoption.setAttribute('value',statevalue);
		stateoption.setAttribute('selected','selected');
		stateoption.innerHTML = statevalue + ' (Custom)';
		ddl.appendChild(stateoption);
	}

	ddl.appendChild(stateoption);

	// Add the drop down and size accordingly.
	statecell.appendChild(ddl);
	ddl.onchange = textState;
	ddl.style.width = '100%';
}

function textState()
{
	// Find drop down and real textbox
	provinceid = 'stateorprovince';

	var stateobject = document.getElementById(provinceid);
	if (!stateobject)
	{
		provinceid = 'address1_stateorprovince';
		stateobject = document.getElementById(provinceid);
	}
	var ddl = document.getElementById('new_stateorprovince');

	// if dropdown value is customselection, show real textbox
	if (ddl.value=='customselection')
	{
		// Get the state or province cell.
		var statecell = document.getElementById(provinceid + '_d');
		statecell.removeChild(ddl);
		stateobject.style.display = 'inline';
	} else {
		// if dropdown is not customselection,
		// put value from ddl into real textbox.
		stateobject.value = ddl.value;
	}

}
ddlState();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mscrmblogger.com/2009/05/11/change-crm-address-state-to-a-drop-down-box/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

