585 views

Description

The item ordering form does not render correctly if the validation script applied has comments before the function name. Two problems may occur:
- The Cart widget is not visible on the page
- An error appears in the console: Uncaught ReferenceError: validate_glide_date_time is not defined

Steps to Reproduce

  1. Log in to the demo instance.
  2. Navigate to Service Catalog > Catalog Definition > Maintain Items.
  3. Create a new catalog item.
  4. Create a date/time variable.
  5. Create a validation script for the Date/Time Type:

    /*
    //function validate(value) {
    //    if(!value){
    //    return true;
    //}
    //    return (getDateFromFormat(value,'yyyy-mm-dd hh:mm:ss')!=0);
    //}
    */
    function validate(value) {
    var format = g_user_date_time_format;
      if (!value) {
       return true;
      }
      return (getDateFromFormat(value,format) != 0);
     
    }

  6. Try the new catalog item by entering a value for the date/time.
    There is no option to proceed to checkout. Note that the developer tools shows this error: 

    Uncaught ReferenceError: validate_glide_date_time is not defined

Workaround

Move the comments below the end of the function. For example, the script above can be changed to:

function validate(value) {
    var format = g_user_date_time_format;
    if (!value) {
       return true;
    }
    return (getDateFromFormat(value,format) != 0);
}
/*
//    function validate(value) {
//       if(!value){
//          return true;
//       }
//       return (getDateFromFormat(value,'yyyy-mm-dd hh:mm:ss')!=0);
//    }
*/

Try the catalog item again. You should be able to proceed to checkout and the console should be clean.


Related Problem: PRB646373

Seen In

Fuji Patch 3 Hot Fix 2

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2015-10-23 10:33:32
Published:2015-09-09