onSubmit catalog client script fails with ReferenceError: x is not definedIssue A record producer contains an onSubmit catalog client script that validates that at least one checkbox variable is selected before the record producer is submitted. This client script fails with the following error: "onSubmit script error: ReferenceError: x is not defined: function () { [native code] }" Release Any supported release Cause This error appears because inside the onSubmit catalog client script, the following line of code declares the variable x without the var keyword: for(x=0;x<mandatory.length;x++){ ResolutionThe resolution is to change the line so the x variable is declared with the var keyword, for example for(var x=0;x<mandatory.length;x++){. Save the catalog client script and test the record producer submission to confirm the error no longer appears.Locate the following line of code in the onSubmit catalog client script:for(x=0;x<mandatory.length;x++){Change the previous line of code to include the var keyword to declare the x variable, that is, change it to:for(var x=0;x<mandatory.length;x++){ Related Links - [onSubmit catalog client script ReferenceError: x is not defined](https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0860189)