This is the source for that field nothing special
<xp:inputText
id="TimeField"
value="#{doc.TimeField}"
styleClass="dateField"
disableClientSideValidation="false">
<xp:dateTimeHelper></xp:dateTimeHelper>
<xp:this.converter>
<xp:convertDateTime
type="time"
timeStyle="short">
</xp:convertDateTime>
</xp:this.converter>
<xp:eventHandler
event="onclick"
submit="false">
<xp:this.script><![CDATA[var f=XSP.getElementById("#{id:TimeField}");
if(f.value==""){
var d=new Date()
var h=d.getHours();
if(new String(h).length==1){
h="0"+new String(h)
}
f.value=h+".00"
} ]]></xp:this.script>
</xp:eventHandler></xp:inputText>
and then I have a button that sets a scoped variable
<xp:button id="button3" styleClass="buttons">
<xp:this.value><![CDATA[#{javascript:var Status=viewScope.Status;
if(Status=="Planerad"){
return "Omplanera"
} else {
return "Planera"
}}]]></xp:this.value>
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:viewScope.Status="Planerad"
}]]></xp:this.action>
<xp:this.script><![CDATA[var status=document.getElementById("status");
if(status){
status.value="Planerad"
}]]></xp:this.script>
</xp:eventHandler></xp:button>