PDA

View Full Version : Ask for help with the Jason's Date Input Calendar



marulya
11-04-2005, 08:14 PM
I have downloaded and initialized the Jason's Date Input Calendar (http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm) but I need to use something like this in the html code:


<script>DateInput('EstimatedDate', true, 'MM/DD/YYYY', '10/12/2005')</script>
<script>DateInput('EstimatedDate', true, 'MM/DD/YYYY', '11/11/2005')</script>
<script>DateInput('EstimatedDate', true, 'MM/DD/YYYY', '09/08/2005')</script>

The problem is that when I declare those calendars the script confuses and when I submit the form it submits the DefaultDate, that I have initialized each calendar with. And I need to change those dates but it is not possible :( I suppose that this is happening because the script uses only the name of the hidden field to enter the value of the calendar. Is it possible to change calendarDateInput.js so that it uses ids of the hidden fields, not only names and this ids to be the difference between the fields with the same name ... The problem is that I am not so familiar with JavaScript and cannot do it myself. I hope that this could be fixed, because I need that script. If someone gets to another way of doing it, than submitting a collection (the number of those fields is not known!) - I am open for ideas :)
Best Regards.

marulya
11-05-2005, 12:58 PM
I've made some changes to calendarDateInput.js

1. I added 2 variables, although it can be just one:


var HiddenFieldIdNum = 1;
var HiddenFieldID = 'Fid' + HiddenFieldIdNum;

2. I changed some of the code, begining from line 556:


writeln('<input type="hidden" id="' + HiddenFieldID + '" name="' + DateName + '" value="' + InitialDate + '">');
// Find this form number
for (var f=0;f<forms.length;f++) {
for (var e=0;e<forms[f].elements.length;e++) {
if (typeof forms[f].elements[e].type == 'string') {
if ((forms[f].elements[e].type == 'hidden') && (forms[f].elements[e].name == DateName) && (forms[f].elements[e].id == HiddenFieldID)) {
HiddenFieldIdNum++;
HiddenFieldID = 'Fid' + HiddenFieldIdNum;
eval(DateName + '_Object.formNumber='+f);
break;
}
}
}
}

But this i still not working ... I am sure that it is possible to be done, there is a nice way of selecting a field by its' id and changing its' value:


document.getElementById('[Field's ID]').value="[New value]";

The problem is that I am not so good at this and I am missing something but I do not know what it is ... Please help me goint out of this situation.

Best Regards!