I have a form in MVC5 which is rendered dynamically with repeating 4 fields. One of these fields is time picker.
What I want to achieve: Select time in first time field and copy this value to others time fields using change and after value in other time fields is changed these fields needs to be still editable independently on others, so when I decide to change value in 3rd time field it can not affect values in 1st and 2nd field only in the 3rd.
Do you know how can I achieve required functionality?
My input field:
@Html.TextBoxFor(model => model.MyModels.Model[i].Time,
new
{
@class = "form-control",
ng_Model = "Model_Time" + (i + 1),
change = "copyTime(" + (i + 1) + ")",
moment_picker = "Model_Time" + (i + 1),
format = "LT",
locale = "nl",
ng_model_options = "{ updateOn: 'blur' }",
set_on_select = true
})
My ng_change function:
$scope.copyTime = function (index) {
console.log("Check if copy function is called");
$scope.Model_Time2 = $scope.Model_Time1;
$scope.Model_Time3 = $scope.Model_Time1;
$scope.Model_Time4 = $scope.Model_Time1;
$scope.Model_Time5 = $scope.Model_Time1;
};
I have a form in MVC5 which is rendered dynamically with repeating 4 fields. One of these fields is time picker. What I want to achieve: Select time in first time field and copy this value to others time fields using change and after value in other time fields is changed these fields needs to be still editable independently on others, so when I decide to change value in 3rd time field it can not affect values in 1st and 2nd field only in the 3rd. Do you know how can I achieve required functionality? My input field:
My ng_change function: