Answered by:
CRM 2011 CheckBox Onclick Event

Question
-
Hi ,
i Have a requirement of on click event of the check box. I have written the following code. Each and every time i am getting the value at true for the checkbox (new_tagvaluesshowpicklist) on click event.
My requirement was on click of the CheckBox, it shoud give true or false in the toggle function where i can do some custom events.
Can help me how to achieve this or sample code.
functin Onload()
{
var el = document.getElementById("new_tagvaluesshowpicklist");
} // el.attachEvent('onclick', Onchangefunction, false);function onchangefunction()
{
var a = Xrm.Page.data.entity.attributes.get("new_tagvaluesshowpicklist");
if (Xrm.Page.ui.controls.get("new_tagvaluesshowpicklist") == undefined) {
return;
}
var _attribuite = Xrm.Page.getAttribute("new_tagvaluesshowpicklist");
if (_attribuite.getValue() == true) {
//show the below fields
ShowOrHideField("new_tags", true, true); //showing the field
}
else {
//Hide the Below fields
ShowOrHideField("new_tags", false, true); // Hiding the field
}}
Thanks
srinivas
Thursday, September 8, 2011 4:52 PM
Answers
-
Hi,
CRM 4.0 will still work, you may refer the following link for CRM 2011 code: http://blogs.inetium.com/blogs/azimmer/archive/2011/03/27/trigger-on-change-on-checkboxes-in-crm-2011.aspx
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by Jehanzeb.Javeed Thursday, September 8, 2011 8:15 PM
- Marked as answer by srinvias.rajulapudi Friday, September 9, 2011 11:29 AM
Thursday, September 8, 2011 6:28 PM
All replies
-
Hi,
Try the solution mentioned in the following post: http://crmdm.blogspot.com/2011/03/checkbox-onchange-event-is-not-working.html
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".Thursday, September 8, 2011 5:11 PM -
Hi,
The code given in the link was for CRM 4.0, Can you post me the code for CRM 2011.
Thanks,
srinivas
srinivasThursday, September 8, 2011 6:16 PM -
Hi,
CRM 4.0 will still work, you may refer the following link for CRM 2011 code: http://blogs.inetium.com/blogs/azimmer/archive/2011/03/27/trigger-on-change-on-checkboxes-in-crm-2011.aspx
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by Jehanzeb.Javeed Thursday, September 8, 2011 8:15 PM
- Marked as answer by srinvias.rajulapudi Friday, September 9, 2011 11:29 AM
Thursday, September 8, 2011 6:28 PM -
Try this:
1. include jQuery library to the form
2. OnLoad, attach the On Click event:
$('#new_checkbox').click(FunctionCheckboxOnClickHanlder);
Cheers,
TajPS: I know this is a very old question, but my answer is for those who come across the same problem
- Proposed as answer by Taj U Tuesday, June 12, 2012 7:13 AM
Tuesday, June 12, 2012 7:09 AM -
For 2013 and forward, this is no longer necessary, OnChange fires as soon as the user clicks an option. Doing a migration, and needed to update some old hacky code. Turns out I just needed to remove it!
- Proposed as answer by MichaelBlackburn Wednesday, June 7, 2017 8:21 PM
Wednesday, June 7, 2017 8:21 PM