Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
When comments are created at start of validation script, the cart is not visible - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • When comments are created at start of validation script, the cart is not visible
KB0551371

When comments are created at start of validation script, the cart is not visible


1178 Views Last updated : Apr 7, 2024 public Copy Permalink
KB Summary by Now Assist

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

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.