title: Thymeleaf hide certain feature using if statement if the user choose certain option?
body: <p>My selection has Document Type, Year and Month and My document type consists of Monthly Report and Annual Report</p>
  <p>But if my document type is selected as &quot;Annual Report&quot;, I want to hide the &quot;Month&quot; selection since Annual Report is based on Yearly basis. How do I put such if statement into my html?</p>
  <p>thymeleaf html</p>
  <pre><code>            &lt;table class=&quot;table table-borderless&quot; cellspacing=&quot;0&quot;
                                  style=&quot;border-inline: 0;&quot;&gt;
  
                                  &lt;tbody&gt;
                                      &lt;div th:if=&quot;${user!=null}&quot;&gt;
                                      &lt;tr&gt;
          &lt;!-- Document Type --&gt;
                                          &lt;td th:text=&quot;#{DocType}&quot; /&gt;
                                          &lt;td colspan=&quot;1&quot;&gt;
                                              &lt;div class=&quot;dropdown col-sm-6&quot;&gt;
                                                  &lt;select id=&quot;documentType&quot; class=&quot;browser-default custom-select&quot;
                                                      th:field=&quot;*{type}&quot;&gt;
                                                      &lt;option
                                                          th:each=&quot;doc:${T(enums.DocumentType).values()}&quot;
                                                          th:value=&quot;${doc}&quot; th:text=&quot;${doc.label}&quot;&gt;&lt;/option&gt;
                                                  &lt;/select&gt;
                                              &lt;/div&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;&lt;/div&gt;
                                      &lt;tr&gt;
       &lt;!-- YEAR --&gt;
                                          &lt;td th:text=&quot;#{Year}&quot; /&gt;
                                          &lt;td colspan=&quot;1&quot;&gt;
                                              &lt;div class=&quot;dropdown col-sm-6&quot;&gt;
                                                  &lt;select class=&quot;browser-default custom-select&quot; th:field=&quot;*{year}&quot;&gt;
  
                                                      &lt;option value=&quot;&quot;&gt;Please Select&lt;/option&gt;
                                                      &lt;option th:each=&quot;year : ${years}&quot; th:value=&quot;${year}&quot;
                                                          th:text=&quot;${year}&quot;&gt;&lt;/option&gt;
                                                  &lt;/select&gt;
                                              &lt;/div&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;tr&gt;
       &lt;!-- MONTH --&gt;
                                          &lt;td th:text=&quot;#{Month}&quot; /&gt;
                                          &lt;td colspan=&quot;1&quot;&gt;
                                              &lt;div class=&quot;dropdown col-sm-6&quot;&gt;
                                                  &lt;select class=&quot;browser-default custom-select&quot; th:field=&quot;*{month}&quot;&gt;
                                                      &lt;option value=&quot;&quot;&gt;Please Select&lt;/option&gt;
  
                                                      &lt;option th:each=&quot;month : ${months}&quot; th:value=&quot;${month}&quot;
                                                          th:text=&quot;${month}&quot;&gt;&lt;/option&gt;
                                                  &lt;/select&gt;
                                              &lt;/div&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                  &lt;/tbody&gt;
                              &lt;/table&gt;
  </code></pre>
  <p>DocumentType.java</p>
  <pre><code>public enum DocumentType {
  
    MONTHLY(&quot;MONTHLY&quot;, &quot;Monthly Report&quot;),
  
    ANNUAL(&quot;ANNUAL&quot;, &quot;Annual Report&quot;),
  
    private String code;
  
    private String label;
  
    DocumentType(final String code, final String label) {
      this.code = code;
      this.label = label;
    }
  
    public String getCode() {
      return code;
    }
  
    public String getLabel() {
      return label;
    }
  }
  </code></pre>