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

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 II
Super User II

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 Specialist
Solution Specialist

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Users online (40,767)