Power Pages: Validate Note Control

Problem Statement

Sometimes, before submitting the form, you have to verify Note Control to determine if the user has uploaded the document or not.

Solution

You can write following JavaScript code on either Basic Form or Multi Step form

var HasNoteAttachment = $('.note').length;
var HasFileUploaded = $('#AttachFile').val();
if(HasNoteAttachment == 0 && HasFileUploaded == "")
{
    alert('Please upload document before proceed');
    return false;
}

Demo

To demonstrate, I have added a File Upload control to the Multi Step form. When I click Next to move on to the next step, I receive the alert message that is seen in the figure below.

Published by arpitpowerguide

My name is Arpit Shrivastava, who is a Microsoft MVP in the Business Applications category. I am a Microsoft Dynamics 365 and Power Platform enthusiast person who is having a passion for researching and learning new things and acquiring immense knowledge. I am providing consistent help, support, and sharing my knowledge through various Social Media Channels along with my Personal Blog, Microsoft Community, conducting online training and attending various 365 Saturday Events worldwide and sharing the best Solutions to the readers helping them achieve their goals and objectives in Customer Relationship Space.

Leave a comment