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 / How to validate a reco...
Power Pages
Unanswered

How to validate a record is created in multistep form with a subgrid

(0) ShareShare
ReportReport
Posted on by 67

Dear community experts,

 

How can I do to add a validation to a multistep form that does not allow the user to click "next" if at least one record is added? I am using a subgrid to add those records, below a picture.

 

josegdiazv_1-1692639366061.png

 

 

I really appreciate any help you can provide.

 

Jose G Diaz

 

Categories:
I have the same question (0)
  • Verified answer
    Inogic Profile Picture
    1,135 Super User 2025 Season 2 on at

    Hi @josegdiazv ,

     

    You can validate the multistep form’s step using Custom JavaScript,

     

    Please follow the steps given below,

     

    1. Navigate to the Multistep form,
    2. Look for the step you wish to validate, open the step,
    3. Navigate to Form Options Tab, scroll down for the Custom JavaScript,

     

    Inogic_0-1692707991580.jpeg

     

    Add the Below JavaScript Code,

     

    In the below code,

    • I have created a Duplicate button,
    • I have also hidden the Default Next button,
    • On a specific condition, it clicks the default Next Button,

     

    $(document).ready(() => {

        //Hiding the main button from the form

        $("#NextButton").css("display", "none");

        //Initializing the variables

        let recordCount,duplicateNextBtn;

       

        //Creating a duplicate button

        duplicateNextBtn = "<button type='button' class='btn btn-primary button next submit-btn' id='btnDuplicateNext'>Next</button>"

        $(duplicateNextBtn).insertAfter("#NextButton")

     

        $("#btnDuplicateNext").click(() => {

            //Checking the Records count

            recordCount = $(".entity-grid.subgrid").find("tbody").find("tr").length;

            if (recordCount == 0) {

                alert("Please Add atleast one record in the grid")

            } else { $("#NextButton").click() }

        })

    })

     

    Save and SYNC the Website,

    Thanks!

     

    Inogic Professional Services Division

    Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

    Drop an email at crm@inogic.com

    Services:  http://www.inogic.com/services/

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

  • Jose Gregorio Diaz Profile Picture
    67 on at

    It works perfectly, I appreciate the help. 🙂

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
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard