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

Notifications

Announcements

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)
  • MH-02091453-0 Profile Picture
    125 on at

    any way to do this with a basic form?

     

  • Morgan78 Profile Picture
    169 on at

    Thank you!

  • Verified answer
    Community Power Platform Member Profile Picture
    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

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 55 Super User 2025 Season 2

#2
Lucas001 Profile Picture

Lucas001 25 Super User 2025 Season 2

#3
Jerald Felix Profile Picture

Jerald Felix 23

Last 30 days Overall leaderboard