Jan 12, 2017, 3:22 PM
9 Posts

error with date when creating document

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 1



I'm getting an error whenever I try to save a date to a document.


I have this a date field

                        <xp:inputText id="dateFrom">
                            <xp:dateTimeHelper id="dateTimeHelper1"></xp:dateTimeHelper>
                                <xp:convertDateTime type="date"></xp:convertDateTime>

and this create button


<xp:button value="Create" id="button1">
                            <xp:eventHandler event="onclick" submit="true"
                                <xp:this.action><![CDATA[#{javascript:var newDoc = database.createDocument();
newDoc.appendItemValue("Form", "ProfCatLnk");
newDoc.appendItemValue("DateFrom", getComponent("dateFrom").getValue());



when I click on save, it get an error "problem submitting an area of the page"


Any idea why?

Jan 13, 2017, 9:19 AM
298 Posts
probably trying to save a text value to the date field
I suspect the getComponent("id").getValue() returns a string and you are trying to save that to a date field, which requires the data to be a NotesDateTime value.

You have to convert the data type.