cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

How to disable the checkbox after user checked and uncheck if user click on reset button?

KM
11-Garnet
11-Garnet

How to disable the checkbox after user checked and uncheck if user click on reset button?

Hi,

 

I need to disable the checkbox after user checked the checkbox.I also need to uncheck and enable all the checkbox if user click on reset button. How can I do that?

 

Thank you in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions
RolandRaytchev
21-Topaz I
(To:KM)

Hi @KM ,

this could be done with javaScript.

one possible option could be:

1.) from the checkbox Widgtets Value change event you can call the funciton e.g. goCheck which is defined somehow like this:

 

 

$scope.app.goCheck= function(checkboxname){
if($scope.view.wdg[checkboxname]['value'] == true){
$scope.view.wdg[checkboxname]['disabled']=true
} }

 

 

 

and then wirte in the UI box : for the checkbox  e.g.:

 

 2021-02-05_14-26-45.jpg

this will  work only for one checkbox where you add the call to the javascript box - disadvantage  of this solution -you need to add to every checkbox widget in UI the function with the specific name. I think it will be possible to have  a more general solution but it will be more complex

2.) regarding to the quesiton how to uncheck and enable all checkboxes -you could start form the restet button some code like this:

 

 

//===================
$scope.app.resetCheckBoxes=function()
{
 wdgs=$scope.view.wdg
Object.keys(wdgs).forEach(function(key) { 
 wdg = wdgs[key]
 console.warn(wdg)
    if ( wdg.widgetName.indexOf('checkbox') !=-1) {
       $scope.view.wdg[key]['value']=false;
	   $scope.view.wdg[key]['disabled']=false;
       
   $scope.$applyAsync();}})

}

 

 

and call the app.resetCheckBoxes(); from the UI Javascript box of Reset button 

 

2021-02-05_14-28-01.jpg

View solution in original post

2 REPLIES 2
RolandRaytchev
21-Topaz I
(To:KM)

Hi @KM ,

this could be done with javaScript.

one possible option could be:

1.) from the checkbox Widgtets Value change event you can call the funciton e.g. goCheck which is defined somehow like this:

 

 

$scope.app.goCheck= function(checkboxname){
if($scope.view.wdg[checkboxname]['value'] == true){
$scope.view.wdg[checkboxname]['disabled']=true
} }

 

 

 

and then wirte in the UI box : for the checkbox  e.g.:

 

 2021-02-05_14-26-45.jpg

this will  work only for one checkbox where you add the call to the javascript box - disadvantage  of this solution -you need to add to every checkbox widget in UI the function with the specific name. I think it will be possible to have  a more general solution but it will be more complex

2.) regarding to the quesiton how to uncheck and enable all checkboxes -you could start form the restet button some code like this:

 

 

//===================
$scope.app.resetCheckBoxes=function()
{
 wdgs=$scope.view.wdg
Object.keys(wdgs).forEach(function(key) { 
 wdg = wdgs[key]
 console.warn(wdg)
    if ( wdg.widgetName.indexOf('checkbox') !=-1) {
       $scope.view.wdg[key]['value']=false;
	   $scope.view.wdg[key]['disabled']=false;
       
   $scope.$applyAsync();}})

}

 

 

and call the app.resetCheckBoxes(); from the UI Javascript box of Reset button 

 

2021-02-05_14-28-01.jpg

Thank you 

Top Tags