Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nitin Iyer on Nov 18, 2008 08:05
open dhtmlx forum
Double Calendar to text box.

I would like to attach a double calendar to a text box. What I would like is to allow users to see two months (Current and the next).
I have the following code and want to have two double calendars attached to these boxes:
<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td>Depart</td><td><input type=text Id=depart></td>
</tr>
<tr>
<td>Return</td><td><input type=text Id=return></td>
</tr>
</table>

I have managed to get a single calendar but am not able to get double calendar. If I can verify the retun date to be later than depart date it will be really great.

Any sort of help is really appreciated.
Answer posted by Support on Nov 18, 2008 08:47
Please check attached sample.
Attachments (1)
Answer posted by Nitin Iyer on Nov 18, 2008 23:38
Thank you very much for your reply. On the first look it seems to work perfectly fine. But if you notice you will see that the date in the text box after clicking is always the first default Date.
For example in your files you have set the from date as 06/01/2008 so the first time the script will always display this text no matter where the user clicks. Even if I click on 21/01/2008 the text box will have value: 06/01/2008.
The same applies to the right calendar.

Also can we have two months instead of the same month? like in this case the first month will be 01/2008 and the right will display 02/2008. And then can we also have two sets of calendars? One for the depart date and one for the return date instead of using the same calendar for both the fields?

Im sorry troubling you but i really am a novice and understand 000000 about javascript coding :(

Thanks once again.
Answer posted by Support on Nov 19, 2008 04:05
>>The same applies to the right calendar.
Yep, I missed this point, fixed sample attached to the post. 


>>like in this case the first month will be 01/2008 and the right will display 02/2008.
of course, the buttons on calendar allows to select any months. 
starting values defined in js code by 
         mDCal.setDate("06/01/2008","15/01/2008")
can be changed to the 
         mDCal.setDate("01/01/2008","01/02/2008")

>>And then can we also have two sets of calendars?
You can use the same code to create one more calendar and attach it to the necessary inputs. 
Attachments (1)
3849238.ZIP36.25 Kb
Answer posted by Nitin Iyer on Nov 19, 2008 04:29
Yes now the dates are coming fine. Thank you so much.

I guess I have not been very clear: What currently is happening is: When user clicks on the Depart text box the double calendar comes that allows users to select the depart date from the left calendar and the return date from right calendar.
This wont work for me because I want user to be able to select a depart date from either the left or the right calendar. Then when user clicks on Return text box another double calendar comes up and user can select a date from either the left or the right calendar.
Hope this clears what Im looking for.

Thank you very much.
Answer posted by Support on Nov 19, 2008 06:11

dblCalendar is not purposed for such use-case. 
It still can be used ( sample attached ) for such scenario, but it is far from perfect. 

Attachments (1)
934729.ZIP36.30 Kb