PDA

View Full Version : Jason's Date Input Calendar



wydchr
12-01-2005, 07:31 PM
Hi,

I am trying to use Jason's calendar in a form on my webpage and it works fine but I want to have the order of the date as DD-MM-YYY on the page but no matter what format I specify in the link it always shows as MM-DD-YYYY.
If anyone can enlighten me or point me in the right direction as to where I am going wrong I would be most grateful.

cheers,
David.

Twey
12-01-2005, 08:23 PM
SHOWER PIRATE INFESTATION!!! http://www.merch-bot.com/product_info.php?cPath=30&products_id=220

wydchr
12-02-2005, 09:23 AM
DD Jason's Date Input Calendar
http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm

Hi,

I am trying to use Jason's calendar in a form on my webpage and it works fine but I want to have the order of the date as DD-MM-YYY on the page but no matter what format I specify in the link it always shows as MM-DD-YYYY.
If anyone can enlighten me or point me in the right direction as to where I am going wrong I would be most grateful.

cheers,
David.

jscheuer1
12-02-2005, 09:52 AM
DD-MM-YYY isn't going to get you anywhere, it would need to be:

DD-MM-YYYY

But, that may have just been a typo in your post. Anyways, the only thing that parameter influences is the way the data is stored in the hidden field value. To change the way it appears on your page, you need to layout the visible fields the way that you want them.

wydchr
12-03-2005, 10:41 AM
Thanks, yes it was a typo. The script itself creates the HTML so I guess I'm gonna have to look carefully and see where it actually does that.

cheers,
David

jscheuer1
12-03-2005, 10:59 AM
Well, you want DD-MM-YYYY, right? If you go to near the end of the script, you will find a line that starts (there is only one in the whole script):


writeln('<table cellpadding="0" cellspacing="2"><tr>' +

If you replace it and everything after it in the script with this:


writeln('<table cellpadding="0" cellspacing="2"><tr>' + String.fromCharCode(13) + '<td valign="middle">'); writeln('<select' + InitialStatus + ' class="calendarDateInput" id="' + DateName + '_Day_ID" onChange="' + DateName + '_Object.changeDay(this)">');
for (var j=1;j<=eval(DateName + '_Object.picked.dayCount');j++) {
DaySelected = ((DefaultDate != '') && (eval(DateName + '_Object.picked.day') == j)) ? ' selected' : '';
writeln('<option' + DaySelected + '>' + j + '</option>');
}
writeln('</select>' + String.fromCharCode(13) +
'</td>' + String.fromCharCode(13) + '<td valign="middle">'); writeln('<select class="calendarDateInput" id="' + DateName + '_Month_ID" onChange="' + DateName + '_Object.changeMonth(this)">');
if (!Required) {
var NoneSelected = (DefaultDate == '') ? ' selected' : '';
writeln('<option value=""' + NoneSelected + '>' + UnselectedMonthText + '</option>');
}
for (var i=0;i<12;i++) {
MonthSelected = ((DefaultDate != '') && (eval(DateName + '_Object.picked.monthIndex') == i)) ? ' selected' : '';
writeln('<option value="' + i + '"' + MonthSelected + '>' + MonthNames[i].substr(0,3) + '</option>');
}
writeln('</select>' + String.fromCharCode(13) +
'</td>' + String.fromCharCode(13) + '<td valign="middle">');
writeln('<input' + InitialStatus + ' class="calendarDateInput" type="text" id="' + DateName + '_Year_ID" size="' + eval(DateName + '_Object.picked.yearPad.length') + '" maxlength="' + eval(DateName + '_Object.picked.yearPad.length') + '" title="Year" value="' + eval(DateName + '_Object.picked.yearPad') + '" onKeyPress="return YearDigitsOnly(window.event)" onKeyUp="' + DateName + '_Object.checkYear(this)" onBlur="' + DateName + '_Object.fixYear(this)">');
write('<td valign="middle">' + String.fromCharCode(13) + '<a' + InitialStatus + ' id="' + DateName + '_ID_Link" href="javascript:' + DateName + '_Object.show()" onMouseOver="return ' + DateName + '_Object.iconHover(true)" onMouseOut="return ' + DateName + '_Object.iconHover(false)"><img src="' + ImageURL + '" align="baseline" title="Calendar" border="0"></a>&nbsp;');
writeln('<span id="' + DateName + '_ID" style="position:absolute;visibility:hidden;width:' + (CellWidth * 7) + 'px;background-color:' + CalBGColor + ';border:1px solid dimgray;" onMouseOver="' + DateName + '_Object.handleTimer(true)" onMouseOut="' + DateName + '_Object.handleTimer(false)">');
writeln('<table width="' + (CellWidth * 7) + '" cellspacing="0" cellpadding="1">' + String.fromCharCode(13) + '<tr style="background-color:' + TopRowBGColor + ';">');
writeln('<td id="' + DateName + '_Previous_ID" style="cursor:default" align="center" class="calendarDateInput" style="height:' + CellHeight + '" onClick="' + DateName + '_Object.previous.go()" onMouseDown="VirtualButton(this,true)" onMouseUp="VirtualButton(this,false)" onMouseOver="return ' + DateName + '_Object.previous.hover(this,true)" onMouseOut="return ' + DateName + '_Object.previous.hover(this,false)" title="' + eval(DateName + '_Object.previous.monthName') + '"><img src="' + PrevURL + '"></td>');
writeln('<td id="' + DateName + '_Current_ID" style="cursor:pointer" align="center" class="calendarDateInput" style="height:' + CellHeight + '" colspan="5" onClick="' + DateName + '_Object.displayed.goCurrent()" onMouseOver="self.status=\'Click to view ' + CurrentDate.fullName + '\';return true;" onMouseOut="self.status=\'\';return true;" title="Show Current Month">' + eval(DateName + '_Object.displayed.fullName') + '</td>');
writeln('<td id="' + DateName + '_Next_ID" style="cursor:default" align="center" class="calendarDateInput" style="height:' + CellHeight + '" onClick="' + DateName + '_Object.next.go()" onMouseDown="VirtualButton(this,true)" onMouseUp="VirtualButton(this,false)" onMouseOver="return ' + DateName + '_Object.next.hover(this,true)" onMouseOut="return ' + DateName + '_Object.next.hover(this,false)" title="' + eval(DateName + '_Object.next.monthName') + '"><img src="' + NextURL + '"></td></tr>' + String.fromCharCode(13) + '<tr>');
for (var w=0;w<7;w++) writeln('<td width="' + CellWidth + '" align="center" class="calendarDateInput" style="height:' + CellHeight + ';width:' + CellWidth + ';font-weight:bold;border-top:1px solid dimgray;border-bottom:1px solid dimgray;">' + WeekDays[w] + '</td>');
writeln('</tr>' + String.fromCharCode(13) + '</table>' + String.fromCharCode(13) + '<span id="' + DateName + '_DayTable_ID">' + eval(DateName + '_Object.buildCalendar()') + '</span>' + String.fromCharCode(13) + '</span>' + String.fromCharCode(13) + '</td>' + String.fromCharCode(13) + '</tr>' + String.fromCharCode(13) + '</table>');
}
}
}

It should work out for you.

wydchr
12-03-2005, 07:21 PM
That works a treat, thanks a lot jscheuer1... I guess the next obvious step is for someone to write an 'if then else' piece of code in order to have which date format one chooses.

cheers,
David

spvemm
11-27-2007, 09:46 AM
Hi, is there a way to add 2 buttons to go to the previous and next year? These buttons are to be similar to those by which you can go to the previous and next month in the control. Thanks.