Submit embedded form programmatically issue

Hi,

my requirement is to add box with yes and no button on submit of form, when user clicks ‘Complete’ button. I am trying to implement that when the box appears then evt.submitPrevented = true; and on click of yes button evt.submitPrevented = false;
$scope.complete();

but $scope.complete(); is not working for me. I tried camForm.submit() also but no luck. Please help.

camForm.on(‘submit’, function(evt) {

      document.getElementById('confirmBox').style.display="block";
      document.getElementById('message').innerHTML='Test';
      evt.submitPrevented = true;

      document.getElementById('ok').onclick = function(){           	  
          evt.submitPrevented = false;
          $scope.complete();
         document.getElementById('confirmBox').style.display="none";
}

      document.getElementById('cancel').onclick = function(){
        evt.submitPrevented = false;
        document.getElementById('confirmBox').style.display="none";
  }
});

@sebastianmonzel
Hi Sebastian,
I have seen in one of the replies from you to use $scope.complete() but it is not working for me. I am not sure what i doing wrong. Please suggest. I am totally stuck with this task. Thanks.

Hi @depti,

$scope.complete() will cause a new submit event. Because you always prevent these (evt.submitPrevented = true;), your form won’t be submitted.

thank you @martin.stamm. It helped. My understanding was that $scope.complete() will call internal APIs not the same method again. Good learning. Have a nice day.