cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shahriat
Helper II
Helper II

How to manually redirect one step to another in webform using JavaScript

I have following code added in a webform step's custom JavaScript. When click on Next button after validating some data I want to redirect to the next step but it doesn't work.
 
$(document).ready(function () {
webFormClientValidate = function () {
validateX(function(flag) {
return flag;
});
};
 });
 
function validateX(callback) {
    checkX()
        .then((response) => {
            if (!response) {
                $('html, body').animate({
                    'scrollTop': $('.validation-summary').position().top
                });
            } else {
                var entityId = $('#EntityFormView_EntityID').val();
                return returnPromise1(entityId);
            }
        }).then((entityId) => {
            if (entityId&& entityId.length > 0return returnPromise2(entityId);
        }).then((entityId) => {
            if (entityId&& entityId.length > 0) {
                callback(true);
            }
            else callback(false);
        });

}
 
how can I redirect to the next step using these above code?
5 REPLIES 5
OliverRodrigues
Super User
Super User

Hi, just to double check, is this a Power Apps Portals question?

 

have you followed the documentation: https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/add-custom-javascript


------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

Hi Oliver, 

Thanks a lot for your reply. 

I have asked the question related to portal and already added my above code as custom javascript in one of the webform's step. 

 

-

Thanks

thanks for clarifying 

 

I would recommend following MS documentation on the web form validation (link sent previously) 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

Fubar
Solution Sage
Solution Sage

Don't think it will work.  Believe the steps (navigation) are managed in a form session stored in CRM e.g. if you are on Step 1 and paste the url from Step 4 think you will find Step 4 is not loaded.

 

Question would be why do you need to manually load a Step rather than using the existing Condition step logic?

 

Jakub_M
New Member

Any help on that? I’m facing a similar issue. 
The reason is that for the condition step logic to work you need an existing record to perform the condition logic on.

My client is expecting 1000s of forms being filled out with only a fraction qualifying to actually create a record, based on a series of questions. Need to avoid creating 1000s of records that wouldn‘t have a future either way.

 

My approach is using JavaScript validation on the Next/Submit button with the function webFormClientValidate.

How would I include a redirect directive in JavaScript on that button?

 

Please help if you know the answer.


Best regards,

 

Jakub Marciniak

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel News & Announcements 768460.png

What's New in the Community?

Check out the latest News & Events in the community!

MPP IDEAS updated 768x460.png

Ideas

Discover ideas and concepts from users like you for how to use Power Pages and take your work to the next level.

Users online (3,573)