Skip to content

Commit

Permalink
Added check for if variable changes input (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmde authored Mar 8, 2023
1 parent 4a92a9f commit 23897be
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Emrald_Site/EditForms/EventEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ function isModified() {
return isDirty;
}

/**
* Checks the form data for invalid values and prompts the user to correct them.
*
* @returns {string} An empty string if the data is valid, or a description of the error if not.
*/
function ValidateData() {
var scope = angular.element(document.querySelector('#EEControllerPanel')).scope();
if (scope.typeOption.value === 'et3dSimEv' && !scope.data.variable && scope.data.extEventType.value === 'etCompEv') {
Expand All @@ -116,6 +121,14 @@ function ValidateData() {
if (scope.typeOption.value === 'etComponentLogic' && !scope.data.logicTop) {
return "Please specify a top logic gate before saving the event.";
}
if (
(scope.distUsesVariable()
|| scope.data.timer.useVariable
|| scope.data.failureRate.lambda.useVariable)
&& scope.data.onVarChange === null
) {
return 'Please select an option for handling variable changes.';
}
return "";
}

Expand Down

0 comments on commit 23897be

Please sign in to comment.