jQuery UI Datepicker: getting altFiend function as regular datefield

300
December 08, 2017, at 09:22 AM

I'm using jquery datepicker, and it needs to send yymmd format data to the server for it to get the right information. It displays like 20181207, which is pretty ugly. So to go around that, I decided to use altFormat (yy-mm-dd) & altField (creating another input, and hiding the input that contains yymmdd dates)

Problem comes in here, since this is an altField and not an actual datepicker input, when I click the box, it doesn't have a calender dropdown. I have to add showOn: both to have the calender icon next to it.

Is there any way to get the calender dropdown working for the altField? I read the jquery datepicker website and I can't find anything..

$(document).ready(function () {
var minDates = new Date((dateArrive.getTime() - (preDays * oneDayMil)));
var maxDates = new Date((dateDepart.getTime()) - (oneDayMil));
$('.datepicker').datepicker({
    dateFormat: 'yymmdd',
    altField: "#actualDate",
    altFormat: "yy-mm-dd",
    defaultDate: dateArrive,
    minDate: minDates,
    maxDate: maxDates,
    showOn: "both",
    selectOtherMonths: true,
    gotoCurrent: true,
    numberOfMonths: 1,
});
});

<div class="inner date-option">
<p>
<input type="text" class="" id="actualDate" name="actualDate" value="SelectDate">
<input type="text" class="datepicker" id="arrivalDate" name="arrivalDate" value="Select Date">
</p>
</div>
Rent Charter Buses Company
READ ALSO
Building an object using async ajax calls

Building an object using async ajax calls

I need to return a custom object that relies on multiple async jquery ajax calls

193
How can I get either radio option in a group, to select sibling (hidden) checkboxes?

How can I get either radio option in a group, to select sibling (hidden) checkboxes?

I asked a similar question yesterday, but this scenario is a bit different, because there are several radio options (can be any number of them), and I need for either of them to select the sibling checkboxes (that will be hidden)

226
How to stop the value of an .each loop being the same when appending buttons to a website?

How to stop the value of an .each loop being the same when appending buttons to a website?

I want to be able to assign a unique value to every button in order to pass this value to other functionsThe context of this is a blog stored in a JSON file where the values of the posts are called via index

142
Disable/enable textbox flicker after postback - JavaScript

Disable/enable textbox flicker after postback - JavaScript

I have two divs, each with a checkbox and textbox, in an ASPNET web forms application:

262