<br><br>
<form method="POST" id="form-real-estate-type">
    <div class="center-align">

        <div class="row">
            <span class="segmented">
                <label>
                    <input type="radio" name="adType" value="<%= AD_TYPE.AD_TYPE_SALE.id %>"
                    <% if (selectedAdType === AD_TYPE.AD_TYPE_SALE.id) { %>
                    checked
                    <% } %>>
                    <span class="label"><%= AD_TYPE.AD_TYPE_SALE.title %></span>
                </label>

                <label>
                    <input type="radio" name="adType" value="<%= AD_TYPE.AD_TYPE_RENT.id %>"
                    <% if (selectedAdType === AD_TYPE.AD_TYPE_RENT.id) { %>
                    checked
                    <% } %>>
                    <span class="label"><%= AD_TYPE.AD_TYPE_RENT.title %></span>
                </label>
		    </span>
        </div>

        <br>
        <div id="realEstateTypeSelection" class="collection">
            <% for(const realEstateType of realEstateTypes) { %>

                <a class="waves-effect row collection-item"
                   id="<%= realEstateType.id %>"
                   href="#"
                   style="color: #02adba"
                   onclick="saveAndSubmit(this.id)"
                >
                    <span class="center-align"><%= realEstateType.title %></span>
                </a>

            <% } %>
        </div>
        <input type="hidden" name="realEstateType" id="realEstateType" />
    </div>
</form>

<script>
  function saveAndSubmit(id) {
   $("#realEstateType").val(id);
   $("#realEstateTypeSelection > a").attr("onclick", "");
   $("#form-real-estate-type").submit();
  }
</script>





