logo
Tags down

shadow

How to properly enable/disable Flutter's Button


By : james
Date : October 17 2020, 08:10 PM
I hope this helps you . Put the condition first, if text is empty your button will be disabled.
code :
onPressed: (_textController.text.isNotEmpty) ? () =>  _addNewPair() : null,


Share : facebook icon twitter icon

enable/disable button on a table on selection of dropdown using ng-options not working properly


By : Tomek Smykowski
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You need to bind each row's upload button's disablity state to different model inside $scope, one way for doing that is to hold each row disablity state in it self,so you need to change tests array to an object like this:
code :
$scope.tests = [{name:"A",disabled:1}, {name:"B",disabled:1}, {name:"C",disabled:1}] 
<table>
  <tr data-ng-repeat="test in tests ">
    <td>{{$index+1}}</td>
    <td>{{test.name}}</td>
    <td style="color:red"> pending</td>
    <td><font size="2" color="red"></font>
       <select ng-model="checkStatus" ng-init="checkStatus='NotDone'"
       ng-options="status.sta as status.name for status in status"
       ng-change="changePayStatus(checkStatus,test)"></select>
    </td>
    <td class="col-md-2">
      <p>
           <button type="button" ng-show="!pictureEditor" ng-click="pictureEditor = true"
            ng-disabled="test.disabled" class="btn-primary btn-u-xs">Upload </button>
         ...
      </p>
    </td>
  </tr>
<table>
app.controller('homeCtrl', function($scope){
     $scope.tests = [{name:"A",disabled:1}, {name:"B",disabled:1}, {name:"C",disabled:1}] 
     $scope.status = [{name :"Done", sta : 1}, {name : "NotDone", sta : 0}];
     $scope.changePayStatus = function(status,testItem) {
         console.log(status);
         if(status == 1) {
            testItem.disabled= 0;
         }
         else if(status == 0) {
            testItem.disabled= 1;

         }
     };
});

Disable Enable Submit button - Disable until all fields have values - HTML form check all inputs for answers


By : Kelly Xia
Date : March 29 2020, 07:55 AM
I wish this helpful for you There are multiple parts to disabling / enabling the save button:
Run code whenever a question is answered Disable / Enable Save button
code :
<form>
  <div  id= "select_input" name="select1">
    <select name="select1" onchange="areAllQuestionsAnswered()" required>
      <option disabled selected>Unidade:</option>
      <option>1</option>
      <option>2</option>
      </select>
   </div>

   <div class="input-field ">
     <textarea id= "text_input" name="text" class="materialize-textarea"
       data-length="500" onchange="areAllQuestionsAnswered()"></textarea>
     <label for="text">Long Text.</label>
   </div>

   <div class="input-field">
     <span class="gbp">
       <input id= "value_input" name="value" type="number" min="0"
       max="10000" step="0.05" onchange="areAllQuestionsAnswered()" required><br/>
       <label> value:</label>
     </span>
   </div>
</form>
<script>
  window.areAllQuestionsAnswered = function() {
    var allInputs,allDropDowns,allTextArea,
    arrayOfQuestions,i,j,L,L2,
    questionType,theseQuestions,
    thisQuestion,thisQstnType,thisValue;

    allInputs = document.getElementsByTagName("INPUT");
    allDropDowns = document.getElementsByTagName("SELECT");
    allTextArea = document.getElementsByTagName("TEXTAREA");

    arrayOfQuestions = [allInputs,allDropDowns,allTextArea];

    L = arrayOfQuestions.length;

    for (i=0;i<L;i++) {

      theseQuestions = arrayOfQuestions[i];

      L2 = theseQuestions.length;

      for (j=0;j<L2;j++) {
        thisQuestion = theseQuestions[j];
        thisQstnType = thisQuestion.type;

        if (thisQstnType === 'checkbox') {
          thisValue = thisQuestion.checked;
        } else {
          thisValue = thisQuestion.value;
        }

        if (!thisValue) {
          enableOrDisableSave(false);
          return;//Quit - one of the questions was not answered
        }
      }
    }

    enableOrDisableSave(true);//If the code gets here then all questions
        //were answered
  }

  window.enableOrDisableSave = function(enable) {
    var saveBtn;

    saveBtn = document.getElementById('put submit button id here');

    if (enable) {
      saveBtn.removeAttribute('disabled');//Enable the save button by removing the disable setting
    } else {
      saveBtn.setAttribute('disabled', 'disabled');//Disable the save button by
  //setting the attribute
    }

  }
</script>

Shinyjs cant enable/disable UI element properly


By : user2945389
Date : March 29 2020, 07:55 AM
hope this fix your issue I made two changes and it's working almost as you want : - Initialize the radiobuttons as disabled - Pass only one true/false to the if
code :
library(shiny)
library(shinyjs)
runApp(shinyApp(
  ui = fluidPage(
    shinyjs::useShinyjs(),
    selectizeInput(inputId = "aaa", label = NULL, choices = c('a', 'b', 'c', 'd', 'e', 'f'), selected = NULL, width = '90%',
                   options = list(placeholder = 'Get', 
                                  onInitialize = I('function() { this.setValue(""); }'), maxItems = 5)),
    shinyjs::disabled( # buttons disable at the launching
      radioButtons("bbb", label = NULL, inline = TRUE, width = "100%", selected = 95,
                   choiceValues = list(1, 2, 3),
                   choiceNames = list(
                     div(style = "font-size:24px;", "1%"), 
                     div(style = "font-size:24px;", "2%"), 
                     div(style = "font-size:24px;", "3%")
                   ))
    )

  ),
  server = function(input, output, session) {
    observeEvent(input$aaa, {
      # any(grepl(...)) returns TRUE if one of them is TRUE
      # just grepl(..) would return a vector of TRUE and FALSE
      if(any(grepl("a", input$aaa))){
        shinyjs::enable("bbb")
      }else{
        shinyjs::disable("bbb")
      }
    })
  }
))
library(shiny)
library(shinyjs)
runApp(shinyApp(
  ui = fluidPage(
    shinyjs::useShinyjs(),
    selectizeInput(inputId = "aaa", label = NULL, choices = c('a', 'b', 'c', 'd', 'e', 'f'), selected = NULL, width = '90%',
                   options = list(placeholder = 'Get', 
                                  onInitialize = I('function() { this.setValue(""); }'), maxItems = 5)),
    shinyjs::disabled(
      radioButtons("bbb", label = NULL, inline = TRUE, width = "100%", selected = 95,
                   choiceValues = list(1, 2, 3),
                   choiceNames = list(
                     div(style = "font-size:24px;", "1%"), 
                     div(style = "font-size:24px;", "2%"), 
                     div(style = "font-size:24px;", "3%")
                   ))
    )

  ),
  server = function(input, output, session) {

    observe({
        if(any(grepl("a", input$aaa))){
          shinyjs::enable("bbb")
        }else{
          shinyjs::disable("bbb")
        }
      }
    )
  }
))

How to properly enable and disable constraint in one view controller on button click


By : Mikoziq
Date : March 29 2020, 07:55 AM
may help you . Problem is each time you click the button 1 of the cases fire which eventualy call setupInputFields and cause re-addition of new constraints which may conflict with old ones , so either access old constraints and delete them or create 2 arrays of possible variations and play with activate/deactivate

I want to disable link button after clicking of it and other enable. toggle enable/ disable between both link buttons us


By : user3756679
Date : March 29 2020, 07:55 AM
shadow
Privacy Policy - Terms - Contact Us © voile276.org