This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
close calendar popup on click?
Started 15 years ago by bsimpson | 3 posts |
-
Need help setting it so that when a calendar date is chosen via the popup calendar picker, that the user does not have to double click or click outside the calendar to close it, but that the calendar will close right after you select the date.
I looked into the dhtml calendar authors site (http://www.dynarch.com/demos/jscalendar/doc/html/reference.html#node_toc_node_sec_Temp_1)
and saw that there was an option to have singleClick :True, so i added that code to the "view_functions.php" (so that every time the calendar would display a date it would add that code
script type="text/javascript"
Calendar.setup({
inputField : "element_{$element->id}_3",
baseField : "element_{$element->id}",
displayArea : "calendar_{$element->id}",
button : "cal_img_{$element->id}",
ifFormat : "%B %e, %Y",
onSelect : selectDate,
singleClick :" true"
});
/scriptPosted 15 years ago # -
Hi,
Since it call "selectDate" function, "singleClick" property will not work. You could make replacement for "selectDate" function in "view-functions.php". Try to replace those java script code (around line 401 ~ 411) with this one :
<script type="text/javascript"> Calendar.setup({ inputField : "element_{$element->id}_3", baseField : "element_{$element->id}", displayArea : "calendar_{$element->id}", button : "cal_img_{$element->id}", ifFormat : "%B %e, %Y", onSelect : selectDateNew }); function selectDateNew(cal) { var p = cal.params; var update = (cal.dateClicked || p.electric); year = p.inputField.id; day = p.baseField + '_2'; month = p.baseField + '_1'; document.getElementById(month).value = cal.date.print('%m'); document.getElementById(day).value = cal.date.print('%e'); document.getElementById(year).value = cal.date.print('%Y'); if (calendar.dateClicked) { calendar.callCloseHandler(); // this calls "onClose" (see above) } } </script>
MachForm Support
Posted 15 years ago # -
Thank you, that worked great, It is a little slow on IE6 (stupid 8 year old browser) but does what i need it to do. You guys rock at end user support
Posted 15 years ago #
Reply
You must log in to post.