Saving date with Java : This field is not a valid date -
on xpage have inputtext control:
<xp:inputtext value="#{employeebean.employee.dateofemployment}"> <xp:this.defaultvalue><![cdata[#{javascript:var dt:notesdatetime = session.createdatetime("today"); dt.adjustmonth(-6); return dt.getdateonly();}]]></xp:this.defaultvalue> <xp:this.converter> <xp:convertdatetime type="date"></xp:convertdatetime> </xp:this.converter> </xp:inputtext> the value can e.g.: 2016-10-06
when want save object following message field:
this field not valid date
can tell me can cause of , how should correct code?
the getdateonly() function returns date part of notesdatetime string, xp:inputtext needs store date need work java.util.date. try format:
@adjust( @now(), 0, -6, 0, 0, 0,0); you notice format of returned date different in input field, that's format input control/ server interpret date. if need different format, can change converter this:
<xp:this.converter> <xp:convertdatetime pattern="dd-mm-yyyy"></xp:convertdatetime> </xp:this.converter>
Comments
Post a Comment