First include the jalaliDate.js in header:
<script type="text/javascript" src="jalaliDate.js" ></script>
Next create the form in the body and put at least these elements:
<form action="" method="post" >
<input type="text" name="as_you_wish" id="as_you_wish" onchange="$persianCalendar.$_manualInput(this)" />
<input type="button" name="btnPick" id="btnPick" onclick="$persianCalendar.$openCalendar('as_you_wish', this);" value="Pick Date" />
<input type="submit" name="btnSubmit" id="btnSubmit" value="Check with Server" />
</form>
Class name is $persianCalendar and prefixes all the methods. All methods begin with $.
OnChange event for the input helps to monitor manual addition of date, instead of clicking the pick button.
The argument always is this
. You can use readonly="readonly"
to force using the button.
Note: first argument for the $persianCalendar.$openCalendar function is id of the input element and the second argument always is this
.
If the user manually types a date and then selects the `Pick` button, the valid date is converted to full format `YYYY/MM/DD`.
Non-valid date is deleted.
Valid formats are of type year/month/day. Year is either 2 or 4 digits, which supposed to be valid Jalali years.
Month is 1 to 12 with or without the leading zero.
Day is 1 to 31 (depending on the month) with or without leading zero.