I am having trouble adjusting to the xpages syntax. Can someone point me to some resources that might help me get a better understanding of the syntax for xpages.
At this time I am trying to get a date field to default to the current date. If anyone could help me out here I would appreciate it.
Subject: For now the Designer Help is the best resource…
In the meantime a basic rule of thumb is that for @Functions most semi-colons are replaced by commas when used in XPages. And that @Functions in XPages must comply with javascript.
So, how to get today’s date into a field.
Here I have a Date field bound to a data source. I’ve also have a convertor for Date…
<xp:inputText id="inputText1" value="#{document1.Date}">
<xp:this.converter>
<xp:convertDateTime type="date"></xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
Now I don’t want to have to put in today’s date all the time so I’ll put in default value like so…
<xp:inputText id="inputText1" value="#{document1.Date}">
<xp:this.converter>
<xp:convertDateTime type="date"></xp:convertDateTime>
</xp:this.converter>
<xp:this.defaultValue><![CDATA[#{javascript:var d = @Now();
return @Date(d)}]]></xp:this.defaultValue>
</xp:inputText>
Here I’m using …
var d = @Now();
return @Date(d)
…as you would in Notes more or less.