This topic is locked
[SOLVED]

Code seems to work, but see warning "Too Many Errors. (92% Scanned)" V11 build 43571

7/15/2025 11:51:36 AM
ASPRunner.NET General questions
M
MSchell author

Receive the warning Too Many errors, but Code appears to be OK and work:

img alt

var Reloc = Runner.getControl(pageid, 'Relocation');
var DeptCode = Runner.getControl(pageid, 'DepartmentCode');
var ResCode = Runner.getControl(pageid, 'ResourceCode');
var BusUnit = Runner.getControl(pageid, 'BusinessUnit');
var EarnCode = Runner.getControl(pageid, 'EarningsCode');
var Phyloc = Runner.getControl(pageid, 'PhysicalLocation');
var ActCode = Runner.getControl(pageid, 'ActivityCode');
var ProjCode = Runner.getControl(pageid, 'ProjectCode');
var VP_Name = Runner.getControl(pageid, 'VPName');
var VP_Email = Runner.getControl(pageid, 'VPEmail');
var VP_UserID = Runner.getControl(pageid, 'VPUserID');
var VP_Title = Runner.getControl(pageid, 'VPTitle');
var VP_Approval = Runner.getControl(pageid, 'VPApproval');
var VP_ApprovalDate = Runner.getControl(pageid, 'VPApprovalDate');

//If Paid is selected, Unpaid is deselected
var PaidLeave = Runner.getControl(pageid,'PlaceOnPaidAdminLeave');
var UnpaidLeave = Runner.getControl(pageid,'PlaceOnUnpaidLeave');

PaidLeave.on('change', function(e) {
if (this.getValue() === 'on'){
UnpaidLeave.clear();
}});

UnpaidLeave.on('change', function(e) {
if (this.getValue() === 'on'){
PaidLeave.clear();
}});

//Watch the Unpaid option, if selected then show the fields on the page, and make them required.
UnpaidLeave.on('change', function(e) {
if (this.getValue() === 'on') {
pageObj.showField("VPName");
pageObj.showField("VPEmail");
pageObj.showField("VPUserID");
pageObj.showField("VPTitle");
pageObj.showField("VPApprovalDate");
pageObj.showField("VPApproval");
} else {
pageObj.hideField("VPName");
pageObj.hideField("VPEmail");
pageObj.hideField("VPUserID");
pageObj.hideField("VPTitle");
pageObj.hideField("VPApprovalDate");
pageObj.hideField("VPApproval");

//If UnPaid is not selected remove these values if present

VP_Name.setValue('');
VP_Email.setValue('');
VP_UserID.setValue('');
VP_Title.setValue('');
VP_Approval.setValue('');
VP_ApprovalDate.setValue('');

}
});
// If Unpaid is not selected, hide these fields
if (proxy.PlaceOnUnpaidLeave != 1)
{
pageObj.hideField("VPName");
pageObj.hideField("VPEmail");
pageObj.hideField("VPUserID");
pageObj.hideField("VPTitle");
pageObj.hideField("VPApprovalDate");
pageObj.hideField("VPApproval");

}
else
{
pageObj.showField("VPName");
pageObj.showField("VPEmail");
pageObj.showField("VPUserID");
pageObj.showField("VPTitle");
pageObj.showField("VPApprovalDate");
pageObj.showField("VPApproval");
}

//Watch the Relocation option, if selected then show the fields on the page, and make them required.

Reloc.on('change', function(e) {
if (this.getValue() === 'on') {
pageObj.showField("DepartmentCode");
pageObj.showField("ResourceCode");
pageObj.showField("BusinessUnit");
pageObj.showField("EarningsCode");
pageObj.showField("PhysicalLocation");
pageObj.showField("ActivityCode");
pageObj.showField("ProjectCode");
DeptCode.addValidation("IsRequired");
ResCode.addValidation("IsRequired");
BusUnit.addValidation("IsRequired");
EarnCode.addValidation("IsRequired");
Phyloc.addValidation("IsRequired");
ActCode.addValidation("IsRequired");
ProjCode.addValidation("IsRequired");
//if the relocation option is not selected hide these fields, and remove is required validation.
} else {
pageObj.hideField("DepartmentCode");
pageObj.hideField("ResourceCode");
pageObj.hideField("BusinessUnit");
pageObj.hideField("EarningsCode");
pageObj.hideField("PhysicalLocation");
pageObj.hideField("ActivityCode");
pageObj.hideField("ProjectCode");
DeptCode.removeValidation("IsRequired");
ResCode.removeValidation("IsRequired");
BusUnit.removeValidation("IsRequired");
EarnCode.removeValidation("IsRequired");
Phyloc.removeValidation("IsRequired");
ActCode.removeValidation("IsRequired");
ProjCode.removeValidation("IsRequired");

//If relocation is not selected remove these values if present

DeptCode.setValue('');
ResCode.setValue('');
EarnCode.setValue('');
BusUnit.setValue('');
Phyloc.setValue('');
ProjCode.setValue('');
ActCode.setValue('');

}
});

// If Relocation is not selected, hide these fields
if (proxy.Relocation != 1) {
pageObj.hideField("DepartmentCode");
pageObj.hideField("ResourceCode");
pageObj.hideField("BusinessUnit");
pageObj.hideField("EarningsCode");
pageObj.hideField("PhysicalLocation");
pageObj.hideField("ActivityCode");
pageObj.hideField("ProjectCode");
}
else
{
pageObj.showField("DepartmentCode");
pageObj.showField("ResourceCode");
pageObj.showField("BusinessUnit");
pageObj.showField("EarningsCode");
pageObj.showField("PhysicalLocation");
pageObj.showField("ActivityCode");
pageObj.showField("ProjectCode");
}

ChatGPT 7/15/2025

When you see the warning "Too Many Errors" in ASPRunner.NET, it typically indicates that there are multiple issues or potential concerns in the JavaScript code that is being executed. However, if your code appears to be functioning correctly despite the warning, it may be due to a few common reasons. Below are some possible issues and solutions to consider:

1. Syntax Errors

Ensure that there are no syntax errors in your JavaScript code. Even a missing bracket or semicolon can trigger warnings. Review your code carefully for any typos or incorrect syntax.

2. Unused Variables

If there are variables defined but not used within your code, it might trigger warnings. Ensure all variables you declare are used appropriately.

3. Event Handlers and Duplication

You seem to have multiple event handlers for UnpaidLeave.on('change', ...), which can lead to confusion. You should check if you are attaching the same event handler multiple times, which can cause unexpected behavior.

4. Properly Closing Functions

Make sure that every opening curly brace { has a corresponding closing brace }. In your code, the structure seems correct, but it’s always good to double-check that every function is properly closed.

5. Validation Logic

You have logic that adds and removes validation on fields. Ensure that the logic flows as expected and that removing validation is not done prematurely.

6. Debugging with Console Logs

Add some console logs in various parts of your code to help trace where the execution is going awry. For example:

console.log("PaidLeave changed: ", PaidLeave.getValue());
console.log("UnpaidLeave changed: ", UnpaidLeave.getValue());

7. Review ASPRunner.NET Documentation

Refer to the ASPRunner.NET documentation for any specific guidelines or best practices regarding JavaScript usage within the platform. Sometimes, the platform has specific requirements that need to be followed.

8. Testing in Isolation

If possible, try isolating sections of your code to see if you can pinpoint where the error might be coming from. Comment out certain parts and see if the warning persists.

Sample Refactor

Here’s a brief refactor of the event handler for UnpaidLeave to avoid duplication:

UnpaidLeave.on('change', function(e) {
if (this.getValue() === 'on') {
pageObj.showField("VPName");
pageObj.showField("VPEmail");
pageObj.showField("VPUserID");
pageObj.showField("VPTitle");
pageObj.showField("VPApprovalDate");
pageObj.showField("VPApproval");
} else {
pageObj.hideField("VPName");
pageObj.hideField("VPEmail");
pageObj.hideField("VPUserID");
pageObj.hideField("VPTitle");
pageObj.hideField("VPApprovalDate");
pageObj.hideField("VPApproval");

// Clear values
VP_Name.setValue('');
VP_Email.setValue('');
VP_UserID.setValue('');
VP_Title.setValue('');
VP_Approval.setValue('');
VP_ApprovalDate.setValue('');
}
});

Conclusion

If after reviewing all these points you still encounter the "Too Many Errors" warning, consider reaching out to ASPRunner.NET support or forums with specific details about the code and the environment, as they may have encountered similar issues before.