I have a select option given in my form and values given to it. Like 1.Daily 2.Weekly 3.Monthly
After that i have another select option.I want that select option to change into a date type on selecting 'Monthly' option in the first field. Is this possible?
My html code
<!--Select Data Range and the Frequency -->
<label class="labelColor"><h5><b>Select Data Range and the Frequency *</b></h5></label>
<div class="row">
<input style=width:100px placeholder="From Date" class="textbox-n" ng-model="fromDate" type="text" onfocus="(this.type='date')" id="date">
<input style=width:100px placeholder="To Date" class="textbox-n" ng-model="toDate" type="text" onfocus="(this.type='date')" id="date">
<select style=width:100px type="select" class="textbox-n" id="freq" ng-model="user.freq" ng-change="changeFields()" ng-disabled="isDisabled" ng-options="frequency.name for frequency in frequencysArr" name="freq">
<option id="default" value="" selected="selected">--Select--</option>
</select>
</div><br>
<!--Select Start Day -->
<label class="labelColor"><h5><b>Select Start Date *</b></h5></label><br>
<select style=width:100px type="select" class="textbox-n" id="startDate" ng-disabled="disableFields" ng-model="user.startDate" ng-options="date.name for date in datesArr" name="startDate">
<option id="default" value="" selected="selected">--Select--</option>
</select>
My JS
$scope.frequencysArr = [{ "id": "1", "name": "Daily" }, { "id": "2", "name": "Weekly" }, { "id": "3", "name": "Monthly" }]
$scope.changeFields = function () {
if ($scope.user.freq.name == "Daily") {
$scope.disableFields = true;
}
else if ($scope.user.freq.name == "Weekly") {
$scope.disableFields = false;
$scope.datesArr = [{ "id": "1", "name": "Sunday" }, { "id": "2", "name": "Monday" }, { "id": "3", "name": "Tuesday" }, { "id": "3", "name": "Wednesday" }, { "id": "3", "name": "Thursday" }, { "id": "3", "name": "Friday" }, { "id": "3", "name": "Saturday" }]
}
else if ($scope.user.freq.name == "Monthly") {
}
};
So basically i want to know what to code in my last else if inorder to change my select option into a date type.
I suggest that you hide the select and show another control that represents the date picker..