[Kss-devel] triggering kss change event when writing to a text input with javascript
Arno Blumer
arnoblumer at gmail.com
Thu Jan 31 07:48:33 CET 2008
Hallo
I am sending this message again, as the previous one bounced.
(My apologies - I was sending from a different address than the one I
subscribed with.)
I have a listing of objects, and the fields are updated using kss.
One of the fields is a DateField and the user can update it using a
javascript "date picker":
The date is picked from the calendar/date picker and then javascript updates
a text input with the date.
How can I cause this "change" of the text input to trigger the kss change
event?
It is triggered if I type the date manually into the text input, but not
when its done by the javascript.
This is what pops up the calendar:
if (!(cal && params.cache)) {
window.calendar = cal = new Calendar(params.firstDay,
null,
onJsCalendarDateUpdate,
function(cal) { cal.hide(); });
cal.time24 = true;
cal.weekNumbers = true;
mustCreate = true;
} else {
cal.hide();
}
And this is what writes the date to the text input:
function onJsCalendarDateUpdate(cal) {
var daystr = '' + cal.date.getDate();
if (daystr.length == 1)
daystr = '0' + daystr;
var monthstr = '' + (cal.date.getMonth()+1);
if (monthstr.length == 1)
monthstr = '0' + monthstr;
cal.params.inputField.value = '' + cal.date.getFullYear() + '/' +
monthstr + '/' + daystr;
}
How do I get that last line, that writes the date string to the text input,
to trigger the following kss change event?:
input.title, input.detail, input.nextaction, input.person, input.due:change{
action-server: kss_test_change;
kss_test_change-item: nodeAttr('id', true);
kss_test_change-field: nodeAttr('class');
kss_test_change-value: currentFormVar();
}
I need to update the objects "Due" field, along with the "Title", "Detail"
etc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/kss-devel/attachments/20080131/e67ffb0c/attachment.htm
More information about the Kss-devel
mailing list