Categories | Question details Back To List | ||||||||
myCal.setPosition(input,x,y) doesn't move calendar... Script: <tr> <td><strong>Date of Issue:</strong></td> <td> <input type="text" id="invoice_date" name="invoice_date" value="<?php echo date("Y/m/21"); ?>" style="width: 130px;" /> </td> </tr> <tr> <td><strong>Date Due: </strong></td> <td><strong><input type="text" id="due_date" name="due_date" value="<?php echo date("Y/m/d", strtotime("+1 month",strtotime(date("Y/m/20")))); ?>" style="width: 130px;" /></strong></td> </tr> <script> mCal = new dhtmlxCalendarObject("invoice_date"); mCal.draw(); mCal.setPosition("invoice_date",250,250); </script> <script> mCal2 = new dhtmlxCalendarObject("due_date"); mCal2.draw(); mCal2.setPosition(10,250); </script> My input fields are very close to the right side of the window, and thus the calendar goes off screen and I have to horizontally scroll to find it. I found the setPosition function however in both cases, it does nothing. Answer posted by Alex (support) on May 28, 2009 06:07 Hello, the syntax of the setPosition method is following: calendar.setPosition(obj); or calendar.setPosition(Y,X); So, in your case: mCal.setPosition(documen.getElementById("invoice_date")); or mCal2.setPosition(250,10); Answer posted by Dawson on May 28, 2009 17:07 It doesn't matter which one I use, they still do not move the calender onto the screen. I still have to horizontally scroll to find the calendar. :\ Answer posted by Alex (support) on May 29, 2009 01:52 Please, provide the sample to recreate the issue. Answer posted by Dawson on May 29, 2009 12:02 Hey Alex, It's at http://www.dni-server.no-ip.com/dniwebdesign2/ctrl_panel2/ Username: alex Password: dhtmlx Then go to Invoicing >> New Invoice The two fields are "Invoice Date" and "Invoice Due". Answer posted by Dawson on May 29, 2009 13:05 I'd also like to make the calendar disappear when clicking elsewhere on the screen, however the examples I have found also don't seem to work. Just a note, I am using FireFox. Answer posted by Support on Jun 01, 2009 08:14 >>I'd also like to make the calendar disappear Can be done by adding dhtmlxEvent(document.body,"click",function(){ cal1.hide(); }) where cal1 - reference to calendar instance Answer posted by Support on Jun 01, 2009 08:45 >>It doesn't matter which one I use, they still do not move the calender onto the screen Please check attached sample. In your current code, setPosition called only once during init, but to fix the problem - correction need to be applied , each time when input activated. Attachments (1)
|