Display message on portal based on condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2024 01:19 AM - edited 11-10-2024 10:21 PM
Hello Everyone,
I have a requirement when I open an activity record on portal then a form is opened and under that there are multiple sections/tabs in which I have to show a message (added screenshot) .
Actual requirement -
When activity is in Planning state and all the fields are filled-in (included Classification confirmed if applicable) then it is showed following message on TOP of Planning TAB:
"Planning Phase fields are completed. Please click "Ongoing Activity" button to change the status to Ongoing."
I have used client controller and html code but its not working .
Client controller -
function($scope, spUtil) {
// Define the fields within the section that need to be filled
$scope.sectionFields = ['section_field1', 'section_field2', 'section_field3'];
$scope.sectionFieldsFilled = false;
// Function to check if all fields in the section are filled
$scope.checkSectionFields = function() {
$scope.sectionFieldsFilled = true;
$scope.sectionFields.forEach(function(field) {
var fieldValue = $scope.data.record[field];
if (!fieldValue) {
$scope.sectionFieldsFilled = false;
}
});
};
// Watch for changes in the form data for the section fields
$scope.$watch('data.record', function(newVal, oldVal) {
$scope.checkSectionFields();
}, true);
// Initialize field check on load
$scope.checkSectionFields();
}
HTML -
<div>
<!-- Conditionally display the message if all section fields are filled -->
<div ng-if="sectionFieldsFilled" class="alert alert-info">
All required fields in this section are filled.
</div>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 04:21 AM
can someone please help me to achieve this requirement