Can't get 'comment' value from camForm

I want to get ‘refusalComment’ from my form (when i write some value into it ) but i can’t make this operation every time i deploy project i got this error:

ReferenceError: variableValue is not defined
at Array.eval (eval at (camunda-tasklist-ui.js?bust=7.8.0:5), :27:84)
here is my code example:
form role=“form”>

var selectedDocuments=$scope.selectedDocuments=;
var variableManager=camForm.variableManager;
var json=$scope.json={
id:1,
cardNumber:“12345678”,
organizationNameGE:“ptp”,
organizationNameEN:“psp”
};
$scope.selectedDocuments.push($scope.json);

   camForm.on('form-loaded', function() {

    // declare a 'json' variable 'customer'
    camForm.variableManager.createVariable({
      name: 'selectedDocuments',
      type: 'String',
      value: $scope.selectedDocuments
    });
  });

var comments = $scope.comments=[];
comments.length =$scope.selectedDocuments.length ;

  camForm.on('variables-fetched', function() {
    // value has been fetched, bind to $scope.user
    $scope.refusalComment = $( '#refusalComment', camForm.formElement).textContent(variableValue);
    console.log( $scope.refusalComment+"see comment");
    $scope.selectedDocuments=EnrichValue(variableManager.variable('selectedDocuments').value,$scope.refusalComment);
  });
 camForm.on('submit', function(evt) {
    // set value in variable manager so that it can be sent to backend
    
   
    variableManager.variableValue('selectedDocuments', $scope.selectedDocuments);
    
  });
 

function EnrichValue(data,comment){
for(var  i=0;i<Object.keys(json).length;i++){
json[i].comment=comment;
comments[i]=comment;
}

return json;
}
 camForm.on('submit', function(evt) {
    // set value in variable manager so that it can be sent to backend
    variableManager.variableValue('comment', $scope.comments);
    variableManager.variableValue('selectedDocuments', $scope.selectedDocuments);
    
  });

  </script>

<div class="container" ng-repeat="item in selectedDocuments track by $index">
<div class="control-group"  >
    <label for="id" class="control-label">id</label>
     <div class="controls">
      <input id="id" class="form-control" type="text" ng-model="item.id"  required  readonly/>
    </div>
  </div>
    <div class="control-group" >
    <label for="cardNumber" class="control-label">card  number</label>
    <div class="controls">
      <input id="cardNumber" class="form-control" type="text" ng-model="item.cardNumber" required />
    </div>
  </div>
   <div class="control-group"  >
    <label for="organizationNameGE" class="control-label" >name</label>
    <div class="controls">
      <input id="organizationNameGE" class="form-control" type="text" ng-model="item.organizationNameGE"  required />
    </div>
  </div>
      <div class="control-group"  >
    <label for="organizationNameEN" class="control-label">name</label>
   <div class="controls">
      <input id="organizationNameEN" class="form-control" type="text" ng-model="item.organizationNameEN"  required />
    </div>
  </div>  
           
        <div class="control-group">
      <label for="refusalComment" class="control-label">comment</label>
      <input type="text"
           class="form-control" 
           cam-variable-type="String"
           cam-variable-name="refusalComment"
           id="refusalComment" />
            </div>      
  </div>   
        
       <div class="container">
        <div class="control-group" >
        <label for="approved" class="control-label">approve</label>  
        <input type="checkbox" id="approved"
       class="form-control" 
       cam-variable-name="approved"
       cam-variable-type="Boolean"/> 
       </div>  
        </div>  
                    
</form>

what should i change to make to get rid of this error?

What is that ‘comment’ variable that you set on submit, is that part of the form? It looks like that is not defined anywhere.

Hi @f_a thank you for your reply,
i have defined my comment inside my form
>

      <label for="refusalComment" class="control-label">comment</label>
      <input type="text"
           class="form-control" 
           cam-variable-type="String"
           cam-variable-name="comment"
           id="comment" />
            </div>      
  </div>

Ok, that looks different from what you posted earlier.

Both give the same error I suppose?

@f_a i have changed this but i still have same error

Hi @Sally,

you have in your variables-fetched function the following line.

Where do you define the variableValue variable?

Cheers
kristin

hi @kristin i have definded var selectedDocuments=$scope.selectedDocuments=; this selectedDocumets which i have used as variableValue in my code

Hi @Sally,

sorry, but I can’t find the variable definition for variableValue in your code snippet.
Did you defined this variable? If not, you get the following error message because the variableValue variable is not defined.

The cause for this must be this code line.

Cheers
kristin

Thank you @kristin for your reply , do you have any idea how can i update/edit form value ( in my case comment) ?

Hi @Sally,

what is your use case? Could you please describe it in more details.

Do you want to change your process variable ‘comment’ in a user task form and update this variable after submitting the form?

Cheers
kristin

Hi @kristin yes i want to change my process variable ‘comment’ in a user task form and update this variable after submitting the form