in Dynamics 365 CRM form there's a checkbox field named opu_paid, if its unchecked, im supposed to disable all fields in the form in javascript. so far im stuck in my code on how to get the value from this checkbox field (wether its true or false) so i can use "setDisabled" method
How do i get the the checkbox field value ?
var formContext = Context.getFormContext();
var paidCheckbox = formContext.getAttribute("opu_paid").getValue() // this is not working
if(!paidCheckbox)
{
formContext.getControl("firstname").setDisabled(true);
formContext.getControl("lastname").setDisabled(true);
}
else
{
formContext.getControl("firstname").setDisabled(false);
formContext.getControl("lastname").setDisabled(false);
}
Pretty sure your attribute name is wrong. Attributes will either be OOB attributes or are required to have a prefix of "something_" to it.
What you have is correct otherwise. If you need more help, you'll need to provide better details like what is getValue() returning? How is it not working?