Oh Well, I have found that current version does have some multidate
selection capabilities.
However I am at a loss.. I dont know jQuery or any java script yet. I
just cannot get it to fill the value with all the selected dates. Here
is what I am trying:
At function: web2py_ajax_init() I add the following, this way, I can
still use the normal date and datetime by passing input field class as
mdate to trigger this one:
try {jQuery("input.mdate").focus( function() {Calendar.setup({
inputField:this.id, ifFormat:"{{=T('%Y-%m-%d')}}",
showsTime:false,
multiple:MA, onclose:closed, field:this.id
}); }); } catch(e) {};
And then I add the following function:
function closed(cal) {
// here we'll write the output; this is only for example. You
// will normally fill an input field or something with the
dates.
var el = document.getElementById("startWhen");
// reset initial content.
el.value = "";
// Reset the "MA", in case one triggers the calendar again.
// CAREFUL! You don't want to do "MA = [];". We need to modify
// the value of the current array, instead of creating a new
one.
// Calendar.setup is called only once! :-) So be careful.
MA.length = 0;
// walk the calendar's multiple dates selection hash
for (var i in cal.multiple) {
var d = cal.multiple[i];
// sometimes the date is not actually selected,
// so let's check
if (d) {
// OK, selected. Fill an input field or something.
el.value += d.getDate() + ",";
// and push it in the "MA", in case one triggers the
calendar again.
MA[MA.length] = d;
}
}
cal.hide();
return true;
};
I have tried passing the field as a param with the input value to be
filled, as in:
var el = document.getElementById(cal.params.field);
Although this is probably wrong sintax, and not even hardcoding the
input field name I get any results.
Anyone can help please? No matter what I try I dont get the list of
values into the field.
Thanks,
Benigno.
On 14 ago, 00:13, Benigno <[email protected]> wrote:
> Hello,
> I need to allow users to select a bunch of dates from a calendar,
> not necessarilly ranges (or contiguous), also it would be ideal to let
> them select something like: all mondays from a month, or horizontally
> as in, a whole week).
>
> Anyway, I haven't seen anyway to do it with calendar.js I see that
> the new version allows for some of that, but it requires buying some
> libraries or something.
>
> Anyone that can tell me if it can be done somehow with calendar.js,
> or if I should look at some other javascript library that would work
> nicelly with web2py?
>
> Cheers,
> Benigno.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---