JavaScript Switch Statment to show text boxes depending on Option Set

Simple Javascript function to show-hide areas depending on Option Set Value


function ShowTextBoxesForType()
{
	Xrm.Page.getControl("term").setVisible(false); 
	Xrm.Page.getControl("longdescription2").setVisible(false); 
	var miOptionSet  = Xrm.Page.getAttribute("recordtype");

	switch (miOptionSet.getValue()) 
	{
        case 1:
			Xrm.Page.getControl("term").setVisible(true); 
			break;
        case 4:
            Xrm.Page.getControl("longdescription2").setVisible(true); 
            break;
       default:           
            break;
    }	
	Xrm.Page.getControl("longdescription").setVisible(true); 
}

I hope it helps.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s