Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Customize & Extend
Unanswered

Execute Page Validator function without Submitting form - Power Portal

(0) ShareShare
ReportReport
Posted on by 130

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.

  • natalya Profile Picture
    133 on at
    Re: Execute Page Validator function without Submitting form - Power Portal

    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

  • Sahil Profile Picture
    130 on at
    Re: Execute Page Validator function without Submitting form - Power Portal

    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?

  • Sahil Profile Picture
    130 on at
    Re: Execute Page Validator function without Submitting form - Power Portal

    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

     

     

  • Fubar Profile Picture
    7,960 Super User 2025 Season 1 on at
    Re: Execute Page Validator function without Submitting form - Power Portal

    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)
  • natalya Profile Picture
    133 on at
    Re: Execute Page Validator function without Submitting form - Power Portal

    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 

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics