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
- 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
- Log in to the demo instance.
- Navigate to Service Catalog > Catalog Definition > Maintain Items.
- Create a new catalog item.
- Create a date/time variable.
- 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);
} - 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