function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jack Rose 1Jack Rose 1 

Creating a controller to assess whether a field is mandatory

Hi All, 

Hoping you can help. I need to make the data categories that are surfaced on our PKB mandatory. I have raised a case with Salesforce for help on this. They have informed me the "required" attribute can't be used and I need to;
  • Create a custom controller
  • The Controller should contain a boolean variable in it.
  • Set the boolean value to true if the data category has --no filter-- as the value
  • Check the value of the boolean variable on the component and display the error message accordingly, when trying to search. 

I need the above to be done per data catergory - preferably with custom error messages. 
Unfortunatley I'm not a developer, but I'm trying to learn more code. Could anyone point me in the right direction to get started. 

Thanks in advance