CA Service Management

 View Only

 CA Service Catalog Cancel Submit Event

Jump to Best Answer
Scott Stineman's profile image
Scott Stineman posted Apr 04, 2024 01:56 PM

Hello: Could someone tell if the following action is possible.  For the onSubmit event of a form, it runs a function that does some last minute validations.  The form then opens a request in CA Service Desk Manager.  Is it possible to stop the submit action so that the request is not created if certain conditions are met?  I thought by adding "return false;" would trigger the cancel, however, that was not the case.  I also tried putting in a try / throw / catch, with the catch containing "result false;" and that too did not work.

The way I'm calling the function in the OnSubmit event field is ca_fd.js.FunctionName();

Any assistance/guidance would be greatly appreciated.  Thank You.  Scott

Satya Kiran Jasti's profile image
Broadcom Employee Satya Kiran Jasti Best Answer

Hi Scott,

Yes, it is possible and your understanding of OnSubmit function is also right. returning any value other than true should stop the request submission.

Ex:

{

     validate: function(){
     if(ca_fdGetTextFieldValue(ca_fd.formId,'empid').length < 4){

      alert("Employee ID must be greater than 4 characters");
       return false;
     }else{
       return true;
     }

}

OnSubmit: ca_fd.js.validate();

Regards,

Satya Kiran

Scott Stineman's profile image
Scott Stineman

Sitya: That worked.  I had forgot to add the function to the onSubmit event.  Once I did, and did a test where the function returned false, it caused the submit to be cancelled.  It's exactly the behavior I was hoping for.  Thank You.