Hello all,
I was wondering if someone could help me on how to attach a single calendar to an input on the form. I was reading the other topic on how to attach a double, but it wasnt working. I kept getting an error in my browser saying that “object missing in calendar.js”.
<a onclick="filter()">click me</a>
The code
<script>
var dhxWins, w1, dhxList;
function filter() {
var formData = [
{type: "input", id: "datefrom", label: "Select a date"},
{type: "button", name: "submit", value: "Filter"}
];
dhxWins = new dhtmlXWindows();
x = (document.body.clientWidth/2)-(400/2);
y = (document.body.clientHeight/2)-(520/2);
w1 = dhxWins.createWindow("w1", x, y, 400, 520);
w1.button("close").enable();
w1.setText("Filter Criteria");
dhxList = w1.attachForm(formData);
dhxList.setSkin("dhx_black");
}
The above example works only for one html input element. When a second html input element is added to the form.The calendar works only for one input element. The one which was activated as first.
[code]
var form, myCalendar;
function doOnLoad() {
var formData = [
{type: "input", name: "calendar1", label: "Date2"},
{type: "input", name: "calendar", label: "Date"},
{type: "button", name: "btn", value: "Submit"}
];
form = new dhtmlXForm("listObj", formData);
dhtmlXForm.prototype.items.input.showCalendar = function(item) {
var inp = item.childNodes[0].childNodes[1].childNodes[0];
inp.onclick = function(e){
e = e||event;
e.cancelBubble = true;
e.returnValue = false;
if (!myCalendar) {
myCalendar = new dhtmlXCalendarObject(this, true);
myCalendar.show();
}
return false;
};
};
form.doWithItem("calendar", "showCalendar");
form.doWithItem("calendar1", "showCalendar");
}
</script>
[/code]
I have in my form multiple input element where I need to add a calendar. (Single calendar)