web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Stop moving to next page using web from in D365 portal

(0) ShareShare
ReportReport
Posted on by

Hi All,

I've created a web from with multiple tab options where each tab is linked with a form/a tab on the form. Now that, I would like stop moving to next page/tab on click on "Next" button when Boolean field on the form is set to No. However, this should allow the user to move to next page when the boolean field value is set to yes. 

Could you please let me know how this can be implemented in D365 portal. 

-Leo

I have the same question (0)
  • cloflyMao Profile Picture
    25,210 on at

    Hi Leo,

    When user clicks the Next/Submit button, a function named webFormClientValidate will be executed.

    You can extend this method to add custom validation logic, here is sample code for how to do extension.(and the page also told us how to add custom javascript to web form step)

    https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/add-custom-javascript#general-validation

    Once the custom code could execute successfully,

    then you could use browser inspector to get boolean field id and get the field check status by jquery.  

    pastedimage1584436834459v1.png

    e.g: the No radio button id is new_acceptance_0, use "$('#new_acceptance_0').prop('checked');" to get its check status.

    In you scenario, the code could be:

    if ($('#new_acceptance_0').prop('checked') === true &&
        $('#new_acceptance_0').prop('checked') === false) {
        return false;
    }

    if the boolean field value equals "No", (radio button 1 is checked and radio button 2 is not checked)

    then return false to prevent next page.

    Regards,

    Clofly

  • LeoFernandas Profile Picture
    on at

    Hi Clofly,

    Thank you very much for this work around.

    I found this working but I do have another issue which I came to know while testing this functionality that, for instance, I'm on second page of the Survey and have selected "No" in Boolean field which is not allowing me to go to next page (working per my logic). However, this doesn't allow me to submit the data entered in that particular page and when I did refresh the page the data were vanished and didn't get saved.

    I'm thinking to have a "Submit Button" which would be enabled on each page when the Boolean value is set to "No" so that I can refrain from data loose.

    Could you please let me know if this a good approach to go or if you have any other approach, please do post me with details.

    Thanks again for your kind response in advance.

    -Leo

  • Fubar Profile Picture
    2,761 on at
    [quote user="LeoFernandas"]

    I'm thinking to have a "Submit Button" which would be enabled on each page when the Boolean value is set to "No" so that I can refrain from data loose.

    Could you please let me know if this a good approach to go or if you have any other approach, please do post me with details.

    [/quote]

    With Web Forms the 'Next' button is the Submit/Save button.

    There is meant to be some new CRUD functionality coming in April that may allow custom updates/saves - but I don't see any documentation for it yet so not sure how it will work etc

  • LeoFernandas Profile Picture
    on at

    Thank much for your answering my queries.

    Could you please let me know if there is a way to only hide next tab instead of disabling the functionality gets triggered on click of Next Button in the current tab/page or to have a custom button called Save which allows to save the data but not to let us go to next page/tab?

    Regards,

    Leo

  • cloflyMao Profile Picture
    25,210 on at

    Hi Leo,

    Do you mean that you just want to prevent submission when only the boolean field equals no?

    e.g: 

    step 1(entity A) -> Step 2(entity B) -> step 3(entity A)

    now the boolean field is on step 2 form, you will be always prevented to step 3 if the field equals no,

    but actually you want to prevent all of 3 forms submission when  the field equals no?

    If so, I'm not sure whether it could be achieved due to each form/page has its own submit button, and custom javascript only runs for corresponding form.

    My thought is that you could create a localStorage object(it'll save in user's browser cache) which is used to mark the boolean field status,

    in step/form that has the boolean field

    if (window.jQuery) {
        (function($) {
            if (typeof(webFormClientValidate) != 'undefined') {
                var originalValidationFunction = webFormClientValidate;
                if (originalValidationFunction && typeof(originalValidationFunction) == "function") {
                    webFormClientValidate = function() {
                        originalValidationFunction.apply(this, arguments);
                        if ($('#new_acceptance_0').prop('checked') === true &&
                            $('#new_acceptance_1').prop('checked') === false) {
                            localStorage.setItem('acceptance', 'false');
                            return true;
                        }
                    };
                }
            }
        }(window.jQuery));
    }

    in your final step, prevent submission by checking the variable value

    if (window.jQuery) {
        (function($) {
            if (typeof(webFormClientValidate) != 'undefined') {
                var originalValidationFunction = webFormClientValidate;
                if (originalValidationFunction && typeof(originalValidationFunction) == "function") {
                    webFormClientValidate = function() {
                        originalValidationFunction.apply(this, arguments);
                            var acceptance = localStorage.getItem('acceptance');
                            cnosole.log(acceptance);
                            if (acceptance === false) {
                                return false;
                            }
                    };
                }
            }
        }(window.jQuery));
    }

    However, you might need to create multiple such objects to save data which were added previously to make fields could still be populated.

    But the method still can't prevent form which has the boolean field be submitted.

    In a word, that's web form design at present, you might need to wait whether new feature which is mentioned by LA could be available in April update.

    Regards,

    Clofly

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 72 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 29 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans