Jungleman
Jungleman

Reputation: 296

OnChange method doesn't trigger on Click - CRM 2011

There is a two options field on my form. First, in onLoad method I have to set null my two options field (The default value is false). So I do;

Xrm.Page.getAttribute("new_iscall").setValue(null);

And It works fine. There is no value in two options field neither true or false. But when I click False, OnChange Event doesn't work. But if I click True, OnChange event works properly. Is there any way to trigger OnChange method with click on the False value?

Upvotes: 0

Views: 377

Answers (1)

Alex
Alex

Reputation: 23290

You can enforce onChange triggering with fireOnChange

Xrm.Page.getAttribute("whatever").fireOnChange();

But it won't help you here: null does't trigger onChange because it's not a valid input for a Two options field, so CRM doesn't "recognize" the field as having changed (because from its POV, it didn't).

My suggestion for a better design would be to make it an Option Set with three options instead (i.e. "Undefined" (default value) / "True" / "False").

Upvotes: 1

Related Questions