I have created an Xpage with a form as the data source. It has 8 fields or so. One some of the fields I want to be able to set a default value (like today's date) but let the user change it.
I have an edit box bound to a date field on my form. If I put in a default value in the edit box control, it never appears unless I make the field read only.
I have tried adding the value in the before and after events.
Nothing works.
This has to be easy and I am overlooking something simple. Please help.
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd='0'+dd
}
if(mm<10) {
mm='0'+mm
}
today = mm+'/'+dd+'/'+yyyy;
var doc:NotesDocument = timeEntry.getDocument();
//var thisDB:NotesDocument = session.getCurrentDatabase()
//var document:NotesDocument = thisD
if (doc.isNewNote()) {
//doc.getComponent("date1").setValue(today);
doc.replaceItemValue("date", today);
}