Question

i have created a form with 3 fields and an xpage with 3 fields too. Each xpage field is binded to a form field using a datasource (datasource name: ds1)

I successfully create and save documents. When i click the save button i execute

ds1.save()

One of the 3 fields data type is Date/Time and i pass from the xpage a string like: dd/MM/YYYY (15/02/2014) When i open the document in Notes client and go to document properties i see the field as Text List data type. If i double click the document and save it again, then in document properties the datatype changes to Date/Time, this is what i want it to be. Some kind of translation runs on re-saving it, maybe sth like computeWithForm...

The question is, how can i do this re-save in my code?

I have tried:

ds1.save();
ds1.getDocument().computeWithForm(false, false);
ds1.getDocument().save();

but it doesnt work. Any ideas?

Was it helpful?

Solution

You have two options.

  1. Set the computeWithForm property on your datasource. Here's an example:

    <xp:dominoDocument var="ds1" formName="example" computeWithForm="onsave"></xp:dominoDocument>
    
  2. Change your date/time field on your XPage to include a converter that converts the field to a date field (and optionally include a date picker):

    <xp:inputText id="dateField" value="#{ds1.dateField}">
        <xp:this.converter>
            <xp:convertDateTime type="date"></xp:convertDateTime>
        </xp:this.converter>
        <xp:dateTimeHelper id="dateTimeHelper1"></xp:dateTimeHelper>
    </xp:inputText>
    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top