Prevent double-submit of the form that could lead to a failing request in the backend.

As this element is wrapped inside a form, the click would otherwise also submit the form.

Closes #11819
This commit is contained in:
Alexander Schwartz 2022-05-04 12:53:49 +02:00 committed by Hynek Mlnařík
parent 5d87cdf1c6
commit ca2c60551d
2 changed files with 5 additions and 2 deletions

View file

@ -2226,8 +2226,11 @@ module.controller('ClientScopeMappingCtrl', function($scope, $http, realm, $rout
return $scope.client.fullScopeAllowed;
}
$scope.changeFlag = function() {
$scope.changeFlag = function(event) {
console.log('changeFlag');
event.stopPropagation();
event.preventDefault();
$scope.client.fullScopeAllowed = !$scope.client.fullScopeAllowed
Client.update({
realm : realm.realm,
client : client.id

View file

@ -15,7 +15,7 @@
<label class="col-md-2 control-label" for="fullScopeAllowed">{{:: 'full-scope-allowed' | translate}}</label>
<kc-tooltip>{{:: 'full-scope-allowed.tooltip' | translate}}</kc-tooltip>
<div class="col-md-6">
<input kc-read-only="!client.access.manage" ng-model="client.fullScopeAllowed" ng-click="changeFlag()" name="fullScopeAllowed" id="fullScopeAllowed" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
<input kc-read-only="!client.access.manage" ng-model="client.fullScopeAllowed" ng-click="changeFlag($event)" name="fullScopeAllowed" id="fullScopeAllowed" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
</div>
</div>
</fieldset>