Help with Dates

Hello all, I have a question on dates with Xpages and passing variables.

I am building a training database exclusively in Xpages, and have the following scenario.

A Course is created, then an administration creates a Course Session with a Start and End Date.

The course session is saved, and a student has the option of enrolling in the session. They choose the session they want, and the course information is passed to the enrollment xpage using variables I pass via sessionScope.

I don’t want the student to change the enrollment fields that get passed from session, so I made them read only, and then I pass the variables to the back-end document on save.

For example here is a bit of the code to set one of the back-end fields:

var doc:NoteDocument = frmEnrolment.getDocument();

doc.replaceItemValue(“EnrolmentCourseID”,sessionScope.SessionCourseID);

This code works great and does exactly what it is supposed to do, that is, save what is in the field that gets passed.

However, when I try and pass the Start Date and End Date fields, no matter what I do they will not populate the back-end document.

If I leave them editable, they will, but I would like to make they read only.

Both the fields on the xpage and the fields on the form are date…not sure why I cannot pass them.

I use the following code to populate the Start date for example from the session to enrollment xpage, and it works fine:

var ssStartDate = currentDocument.getItemValueDate(“SessionSDate”);

sessionScope.put(“SessionSDate”,ssStartDate);

This populates the date fine on the enrolment xpage, but when I try and pass it to the back-end document on the save there using the following code, it does not work:

doc.replaceItemValueDate(“ErnolmentStartDate”;sessionScope.SessionSDate);

Any ideas?