<div class="settingsContainer" >
    <form name="updateSettingsForm" class="form-horizontal" action="@{updateSettings()}" method="post">
        <div class="control-group" >
            <label class="control-label" for="selectSpaceGroupId">Select Space</label>
            <select class="controls" id="selectSpaceGroupId" name="spaceGroupId">
            <% if (spaces != null) {
            spaces.each { space ->
            def   spaceName= space.name;
            def   spaceGroupId= space.groupId;
            def   selected = selectedSpace != null && space.groupId.equals(selectedSpace)?'selected':'';
            %>
                    <option value="${spaceGroupId}" ${selected}>${spaceName}</option>
            <% }
            }
            %>
            </select>
        </div>
        <div class="uiAction">
            <button type="submit" class="btn btn-primary input-large">Save</button>
        </div>
    </form>
</div>