AnsweredAssumed Answered

CA Service Catalog 14.1 Form - OnSubmit JavaScript

Question asked by jwood1 on Sep 8, 2016
Latest reply on Sep 9, 2016 by jwood1

Hi all, 

I am having an issue where information entered in Catalog is not showing in the request details upon submission. 

 

I have a sliding scale that shows hidden values depending on the value of the scale. 

 

As per below, the user can use the sliding scale to select up to a maximum of 5 vendors. 

 

 

Number of vendors sliding scale information

\

 

and *****Field that is hidden******** information

 

 

 

My script is as follows

checkFrmData: function() {
ca_fd.js.displaymyslider();
ca_fd.js.myonsubmit();
},

 

displaymyslider: function() {
var myslider = ca_fdGetSliderValue(ca_fd.formId, 'vendor_slider');

    if (myslider ==1)
      {
      ca_fdShowField(ca_fd.formId, 'ven1_mychosen_name');

   else
   {
      ca_fdHideField(ca_fd.formId, 'ven1_mychosen_name');

 

myonsubmit: function() {

ca_fdEnableFields(ca_fd.formId, ['ven1_mychosen_name']);

}
}

 

 

The code works for my form. 

When I slide from 0 to 1, the field will appear. 

 

If I slide back to 0, the field disappears, which is what I want to happen. 

 

I can now add further code to this and allow the user to choose 5 vendors on the scale and then all 5 fields will become unhidden. 

 

Now when I go to the request form and submit

 

 

 

The final request details are shown as per below.

My issue is that the text entered in red circle is not displaying in the form. 

 

 

I then went back to my form design and added an extra function in the OnSubmit in the main form

 

I adjusted my code as shown in red

checkFrmData: function() {
ca_fd.js.displaymyslider();
ca_fd.js.myonsubmit();
},

 

displaymyslider: function() {
var myslider = ca_fdGetSliderValue(ca_fd.formId, 'vendor_slider');

    if (myslider ==1)
      {
      ca_fdShowField(ca_fd.formId, 'ven1_mychosen_name');

   else
   {
      ca_fdHideField(ca_fd.formId, 'ven1_mychosen_name');

,

myonsubmit: function() {

ca_fdEnableFields(ca_fd.formId, ['ven1_mychosen_name']);

}
}

 

 

 

This resulted in the On Submit button not working. 

 

 

Has anyone got any advice as to how I can show this hidden field and still display it in the final form upon submission?

Outcomes