Friday, June 26, 2015

Populate an InputText Date field (that has a calendar picker)

I didn't see much on this, so I'm posting in case it helps someone.

I'm working on an application that has an XPage that a user fills out, then clicks to get a new version of that page. Most of the data should carry over, including an inputText field for a Domino document bound to a date field and I have the default datepicker on it.

I put the values from the first page into sessionScopes and used that to populate them for the next page. Easier on the user. All of them worked except the date.

Here is what worked.

Getting the value:

var nDT:NotesDateTime = document1.getItemValueDateTime('EventDate');
sessionScope.put("EventDate", nDT.getDateOnly());

Setting the value in afterPageLoad:

document1.replaceItemValue('EventDate', session.createDateTime(sessionScope.EventDate));

I've not found a way to set the component value yet, it's just not worked in any permutation I've tried so far. This does what I need so far, so I stopped trying on the component.


No comments:

Post a Comment