Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by lelegante on Jan 03, 2010 14:01
open dhtmlx forum
setPosition dont work

<div class="lineaForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="120"><div class="etichetta14"><?php echo $txtDataArrivo ?></div></td>
<td><link href="../../Javascript/dhtmlxCalendar/codebase/dhtmlxcalendar.css" rel="stylesheet" type="text/css" />
<script src="../../Javascript/dhtmlxCalendar/codebase/dhtmlxcommon.js"></script>
<script src = "../../Javascript/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script>
<script> window. dhx_globalImgPath = "../../Javascript/dhtmlxCalendar/codebase/imgs/" ;</script>
<script>
                                var cal1, cal2, mCal, mDCal, newStyleSheet, ling;
                                var ling="<?php echo $Ling;?>";
                                dhtmlxCalendarLangModules = new Array();
                                    dhtmlxCalendarLangModules['IT'] = {
                                        langname:    'IT',
                                        dateformat:    '%d/%m/%Y',
                                        monthesFNames:    ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"],
                                        monthesSNames:    ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"],
                                        daysFNames:    ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"],
                                        daysSNames:    ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"],
                                        weekend:    [0, 6],
                                        weekstart:    1,
                                        msgClose:     "Chiudi",
                                        msgMinimize: "Minimizza",
                                        msgToday:     "Oggi"
                                    }
                                    dhtmlxCalendarLangModules['DE'] = {
                                        langname:    'DE',
                                        dateformat:    '%d/%m/%Y',
                                        monthesFNames:    ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
                                        monthesSNames:    ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
                                        daysFNames:    ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
                                        daysSNames:    ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
                                        weekend:    [0, 6],
                                        weekstart:    1,
                                        msgClose:     "Schließen",
                                        msgMinimize: "Minimieren",
                                        msgToday:     "Heute"
                                    }
                                    
                                    var dateFrom = null;
                                    var dateTo = null;
                                
                                window.onload = function () {
                                    mCal = new dhtmlxCalendarObject(['dataIN','dataOUT']);
                                    
                                    mCal.loadUserLanguage(ling);
                                    mCal.setSkin("simplegrey");
                                    mCal.setPosition(100,50);
                                    mCal.draw();
                
                                }
</script>
<div class="campo14Form">
<input id="dataIN" name="dataIN" type="text" class="imput14" value="<?php echo $dataINA; ?>" style="width:360px" readonly="true" />
</div></td>
</tr>
</table>
</div>
<div class="lineaForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="120"><div class="etichetta14"><?php echo $txtDataPartenza ?></div></td>
<td><div class="campo14Form">
<input id="dataOUT" name="dataOUT" type="text" class="imput14" value="<?php echo $dataOUTA; ?>" style="width:360px"/>
</div></td>
</tr>
</table>
</div>

position botton for imput?
Answer posted by Alex (support) on Jan 04, 2010 05:24

setPosition method should be called after draw() method:

  mCal.draw();

  mCal.setPosition(100,50);

Here 100 is vertical position, 50 is horizontal: calendar.setPosition(Y,X). 

Answer posted by lelegante on Jan 04, 2010 08:55
setPosition dont work 
Attachments (1)
menu.php24.47 Kb
Answer posted by Alex (support) on Jan 05, 2010 03:39

If you attach calendar to input, setPosition doesn't affect - position is set automatically in this case.

If you want to define custom position for the calendar, you should initialize calendar in some container:

<div id="dhtmlxCalendar"></div>

...

mCal = new dhtmlxCalendarObject('dhtmlxCalendar');

mCal.draw();

and set onclick event handlers for the necessary inputs to hide/show calendar:

mCal.hide(); / mCal.show();

Answer posted on Jan 06, 2010 09:51
Answer posted by lelegante on Jan 06, 2010 09:55
if I do as you wrote I lose the connection with the input field, how do avoid it?
Answer posted by Alex (support) on Jan 12, 2010 08:39

If calendar is initialized in div, you can set onSelect event handler and put the chosen date into the necessary input. Please check the sample dhtmlxCalendar/samples/02_date_formating/01_calendar_date_format.html

calendar.attachEvent("onClick",function(date){

     document.getElementById("dataIN").value = calender.getFormatedDate();

}