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 / Execute Page Validator...
Power Pages
Unanswered

Execute Page Validator function without Submitting form - Power Portal

(0) ShareShare
ReportReport
Posted on by 132

Hi Folks,

 

Is there any way we can execute the PageValidator.evaluation function on an entity form without actually submitting the form?

 

I have a custom Validate button on my entity form that should show all the errors based on the Page Validators defined on the same form without submitting the form.

 

Thanks in advance.

Categories:
I have the same question (0)
  • natalya Profile Picture
    133 on at

    Hi @Sahil,

     

    You can try to use the following function to prevent your form from submitting.

    function entityFormClientValidate() {
    // Custom client side validation. Method is called by the submit button's onclick event.
    // Must return true or false. Returning false will prevent the form from submitting.
     return true;}

    Hoping it helps.

    NatGeo 

  • Fubar Profile Picture
    8,338 Super User 2025 Season 2 on at

    If I am understanding correctly, you want both a Submit and a Validate Button.  So that you can validate, the out of the box validations like mandatory and also any custom validators you have created.

     

    I won't post all the code etc here but this should give you enough info to work it out (note: what you want to do may not be supported so at some point in time in the future this may not work)

    • Use your browser debugger and Inspect the submit button - you will see the onClick= this is what it currently runs to save/insert
    • For your custom Validate Button
      • Basically use the code from the Submit onClick, but change the first parameter in the "new WebForm_PostBackOptions" to undefined (i.e. JavaScript undefined, not a text string)
  • Sahil Profile Picture
    132 on at

    Hi @Fubar ,

     

    Thanks for the response.

     

    When there are validation errors on the form, this seems to work fine by passing undefined to the WebForm_PostBackOptions function. But when there are no validation errors, and you click validate button, it shows no error/validation box which is expected behavior but if you click Browser's back button, it shows the below error. Seems like browser history is affected, is there any workaround for this?

     

    Sahil_0-1671737936909.png

     

     

  • Sahil Profile Picture
    132 on at

    Thanks for the response, @NatGeo . So, on click of Validate button I should trigger click of Submit button and ensure that the entityFormClientValidate function is always returning false so that the form is not being submitted even if all the validations are passed, right?

  • natalya Profile Picture
    133 on at

    Hi @Sahil,

    By calling "entityFormClientValidate"  method  you will prevent the form from submitting, but the validation will not be initiated.  To initiate the validation and prevent from submitting I would use the code below.

    $(document).ready(function(){
    
     $('#InsertButton').click( function() {
     Page_ClientValidate(); // to initiate validation
     })
    });
    
    function entityFormClientValidate() {
    // Custom client side validation. Method is called by the submit button's onclick event.
    // Must return true or false. Returning false will prevent the form from submitting.
     return false;}

     

    Hoping it helps.

    NatGeo

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