How to Disable the ComboBox Control in the Infor CRM (Saleslogix) Web Client

There’s a problem with the ComboBox control in the Infor CRM (Saleslogix) Web Client. It won’t disable. Sure, it has an Enable property, but setting it to false has no effect on the control and it will remain enabled. However, there is a solution. Luckily, the control itself renders as a Dijit Select form widget from the Dojo UI Library so we can simply manipulate the control based on what can be done to the Dijit Select.

The Problem

As I mentioned earlier, the problem is that setting the ComboBox control’s Enabled property to false does not disable the control. You’ll still end up with the control looking, and worse, behaving as an enabled control (allowing the user to still interact with it).

That’s no good if you want to ensure the user can only access the control if you intend that behavior.

The Solution

The ComboBox control itself actually gets added to the deployed SmartPart as an ASP.NET ListBox with a specific Dojo attribute. It will look like this on the page:

<asp:ListBox runat="server" ID="comboBox1" data-dojo-type="dijit.form.Select" SelectionMode="Single" Rows="1" CssClass="select-control">
</asp:ListBox>

The magic here is the data-dojo-type=”dijit.form.Select” part. At runtime, the Dojo Dijit library does it’s work and changes that to a nice looking Dijit Select dropdown control, AKA the Inform CRM ComboBox. Knowing this, we can manipulate the control as a Dijit Select widget. The Dijit Select widget can be disabled by adding a “disabled” attribute with a value of “disabled” (yep, disabled=”disabled”).

So, to disable the ComboBox in a code snippet, in place of doing this:

comboBox1.Enabled = false;

We can do this:

// disable the combobox
comboBox1.Attributes["disabled"] = "disabled";

This will disable the ComboBox just as you’d expect it to be. Users cannot interact with it and it looks disabled.

 

Then to enable the ComboBox:

// enable the combobox
comboBox1.Attributes["disabled"] = "false";

 

Just as easy as using the Enable property, but the big difference is that it works 🙂

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!