title: Spring MVC and Thymeleaf Button disabled update
body: <p>I have two buttons in my form(first and second). Now, I want to update the disable function of my second button when I click the first one.</p>
  
  <pre><code>&lt;form action="updateButton" method="post" id="something"&gt;
          &lt;h1 th:text="${application.text}"&gt;&lt;/h1&gt;
          &lt;button type="submit" name="first"&gt;First&lt;/button&gt;
          &lt;button type="submit" name="second" th:disabled="${model.disabled}"&gt;Second&lt;/button&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p><strong>My Controller:</strong></p>
  
  <pre><code>private Boolean disabled = false;
  
  public Boolean getDisabled() {
      return disabled;
  }
  
  public void setDisabled(Boolean disabled) {
      this.disabled = disabled;
  }
  </code></pre>
  
  <p>Is there a way to bind the boolean variable with my second button, so that the button enables/disables onclick at the first button? I know I have to write a method with PostMapping("updateButton"). But I don't know how to bind the variable.</p>