web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Make subgrid required ...
Power Pages
Answered

Make subgrid required on entity form

(0) ShareShare
ReportReport
Posted on by 169

Hi all,

 

I've added a subgrid on my entity form with Add, Edit and delete buttons. It works fine.

The requirement is :

1) to prevent user press submit button if there are no lines in the subgrid
2) to make all subgrid fields required

Is this possible OOB or with JavaScript?

Categories:
I have the same question (0)
  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Iro_ 

    You can only achieve that via JavaScript , we have a similar use case when we have a subgrid on Advanced Form that we needed customers to MUST add at least one line and we are using the below code on Advanced Form (ex Web Form) step JS section.

     

    lets assume the subgrid div id is ReselletCert

    if (window.jQuery) {
     (function ($) {
     if (typeof (webFormClientValidate) != 'undefined') {
     var originalValidationFunction = webFormClientValidate;
     if (originalValidationFunction && typeof (originalValidationFunction) == "function") {
     webFormClientValidate = function() {
     originalValidationFunction.apply(this, arguments);
     var rows = $("#ResellerCert tr").length;
    			 if (rows <= 1){ 
     alert("Please enter at least one reseller certificate to proceed.");
     return false; // to prevent the form submit you need to return false
     // end custom validation.
    			 }
     return true;
     };
     }
     }
     }(window.jQuery));
    }

     Manar_0-1649712691585.png

     

     

    to find your subgid id, use Chrome developor tool to inspect and replace "ResellerCert" with your subgrid id 

     

    Manar_1-1649712916370.png

     

     

  • Morgan78 Profile Picture
    169 on at

    Thank you!

  • MH-02091453-0 Profile Picture
    125 on at

    any way to do this with a basic form?

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 17 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 12

#2
CN-06091549-0 Profile Picture

CN-06091549-0 12

Last 30 days Overall leaderboard