In my Velocity (.vm) file, I’m looking to implement functionality where selecting an option in one dropdown will disable the other dropdown. Moreover, if the user selects the ‘–Select–’ option, both dropdowns should be enabled again. How can I achieve this?
<div class="form-group">
<label for="regionId" class="col-sm-2 control-label">Region Name</label>
<div class="col-sm-8">
<select id="regionId" name="regionId" class="form-control dropdown-select">
<option value="">--Select--</option>
#foreach($region in $regionList)
<option value="$region.id">${region.name}</option>
#end
</select>
<span class="help-block" id="help-block-region"></span>
</div>
<div class="col-sm-2"></div>
</div>
<div class="form-group">
<label for="cityId" class="col-sm-2 control-label">City Name</label>
<div class="col-sm-8">
<select id="cityId" name="cityId" class="form-control dropdown-select">
<option value="">--Select--</option>
#foreach($city in $cityList)
<option value="$city.id">${city.name}</option>
#end
</select>
<span class="help-block" id="help-block-city"></span>
</div>
<div class="col-sm-2"></div>
</div>