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 :
Microsoft Dynamics CRM (Archived)

CRM Portals 8.0 JavaScript logic on Submit button

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

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

  • Davey Profile Picture
    115 on at

    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));
    }


  • Community Member Profile Picture
    on at

    Use this simple code first.

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

    })
    });

  • Community Member Profile Picture
    on at

    also check the id of Button is correct

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    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.

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans