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 / How to stop page refre...
Power Pages
Answered

How to stop page refresh or redirecting while submitting webform?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a created a webform for account entity with some steps.

 

In the last step while submitting the form I have ajax code to add a record for my custom entity with account id. 

 

The ajax request is failing because of page refreshing. I want to stop the page refresh or page redirecting until my custom entity's record is saving. 

 

I have added following code:

 

if (window.jQuery) { (function ($) { if (typeof (webFormClientValidate) != 'undefined') { var originalValidationFunction = webFormClientValidate; if (originalValidationFunction && typeof (originalValidationFunction) == "function") { webFormClientValidate = function() { originalValidationFunction.apply(this, arguments); // do your custom validation here // return false; // to prevent the form submit you need to return false // end custom validation. return true; }; } } }(window.jQuery)); }

 

I have added the above code in my last step as custom JavaScript but code doesn't work because webFormClientValidate is getting undefined. Wherever I place this code webFormClientValidate getting undefined. 

 

any suggestion?

 

Categories:
  • Verified answer
    justinburch Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    Just remove the undefined check, there does seem to be a current issue where the code to establish that function is not being included in Web Forms. Another community user ran into the same.

    f (window.jQuery) { (function ($) { if (typeof (webFormClientValidate) != 'undefined') { var originalValidationFunction = webFormClientValidate; if (originalValidationFunction && typeof (originalValidationFunction) == "function") { webFormClientValidate = function() { originalValidationFunction.apply(this, arguments); // do your custom validation here // return false; // to prevent the form submit you need to return false // end custom validation. return true; }; } } }(window.jQuery)); }
    
    $(document).ready(function () {
     webFormClientValidate = function () {
     $.ajax(....);
     };
    });
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Justin,

    Thanks a lot for your valuable response.

    I need another help, like in the step2 I have a map where I draw shapes. Before going to final step I want to pass a json with those shapes to final step. 

     

    Could you please help how can I pass json data to the 3rd step?

     

    -

    Thanks

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 25 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 20

#3
DianePana Profile Picture

DianePana 9

Last 30 days Overall leaderboard