This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.



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

Hello,

 

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

 

I have this a date field

                    <xp:td>
                        <xp:inputText id="dateFrom">
                            <xp:dateTimeHelper id="dateTimeHelper1"></xp:dateTimeHelper>
                            <xp:this.converter>
                                <xp:convertDateTime type="date"></xp:convertDateTime>
                            </xp:this.converter>
                        </xp:inputText>
                    </xp:td>

and this create button

 

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

}]]></xp:this.action>
                            </xp:eventHandler>
                        </xp:button>

 

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
300 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.

Howard

This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.