I have a text box bound to a date picker:
<!-- editExamScheduleModal -->
<div class="form-group">
<label class="col-md-4 control-label" for="textExamDate">Exam Date</label>
<div class="col-md-4">
<input id="textExamDate" name="textExamDate" type="text" class="form-control input-md">
</div>
</div>
This Div is shown as a pop-up and the function that assigns the values to the text box is like so:
function ShowPopup(examDateToEdit) {
$('#textExamDate').val(examDateToEdit);
$('#textExamDate').datepicker({ minDate: 0 });
$('#editExamScheduleModal').modal('show');
var expectedExamDate = new Date();
var numberOfDaysToAdd = 1;
expectedExamDate.setDate(expectedExamDate.getDate() + numberOfDaysToAdd);
$('#textExamDate').datepicker("setDate", expectedExamDate);
}
In the above function I am trying to set the DatePicker to select the next day from the current day or whatever date is passed in examDateToEdit. It's ok if nothing comes in to the function, the date picker will default to current date.
Two things are happening:
- The DatePicker does show the expected date
- It's also putting in the date value in the text box
So if today's date is 01/21/2016 it puts 01/22/2016 in the text box.
The value in this text box is optional, meaning the user can leave it empty. But in my implementation shown above there will be a value in it and when the user hits Save, not shown here, they will unintentionally send a value back to server.
So what do I do to make only #1 happen?
Thanks in advance.
Regards.