Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

CRM Portals 8.0 JavaScript logic on Submit button

Posted on by 115

Hi,

I have a web form with a couple of web form steps.

In my final web form step I want to change the status of the record on submit of the button.

I have included JavaScript in the Custom JavaScript box. For some reason webFormClientValidate is always undefined and so never sets the status code when I click on submit. Any ideas on what I am doing wrong?

if (window.jQuery) {
   (function ($) {
       $(document).ready(function () {
           if (typeof (webFormClientValidate) != 'undefined') {
           var originalValidationFunction = webFormClientValidate;
           if (originalValidationFunction && typeof (originalValidationFunction) == "function") {
               webFormClientValidate = function () {
                     originalValidationFunction.apply(this, arguments);
                     alert("test");
                   //Set Status code to submission in progress
                     $("#statuscode").val(717640002);
              
                     return true;
                 
                 }
             }
         }   
      });
   }(window.jQuery));
}


*This post is locked for comments

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: CRM Portals 8.0 JavaScript logic on Submit button

    Hi Davey,

    If want to change the status of the record on submit of the button then you can achieve this by setting the Web Form metadata on the last step and set the value.

    I achieve the same requirement with this.

    Hope this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRM Portals 8.0 JavaScript logic on Submit button

    also check the id of Button is correct

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRM Portals 8.0 JavaScript logic on Submit button

    Use this simple code first.

    $(document).ready(function() {
    $('#NextButton').on('click', function (e) {
    alert("button was clicked");

    })
    });

  • Davey Profile Picture
    Davey 115 on at
    RE: CRM Portals 8.0 JavaScript logic on Submit button

    Hi Mohd,

    The enable validation summary links has already been set but still not triggering.

    I have modified my code to trigger on click but I am having the same issues.

    Do you know what I am doing wrong? Thanks.

    if(window.jQuery) {
        (function ($) {
            $("#NextButton").on('click', function () {
                alert("click");
                //Set Status code to submission in progress
                $("#statuscode").val(717640002);
                return true;
            }
        }(window.jQuery));
    }


  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRM Portals 8.0 JavaScript logic on Submit button

    Please make sure you check Enable Validation Summary Links under Additional Settings

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans