1

we are developing an app were our technicians can add activities to an ticket.

Therefore they need to choose a date and also the work start time. These should be handeled with to different fields/selections.

For the Date selection we get it running, for the time selection we only get it work via web browser. In Unplugged only a text editbox will be displayed.

Maybe anyone has a running time selector?

Here ́s the code which is not working on unplugged:

<xp:inputText value="#{Activity.work_start}" id="work_start1"
    style="margin-top:10.0px">
    <xp:this.converter>
            <xp:convertDateTime type="time" pattern="HH:mm">
            </xp:convertDateTime>
    </xp:this.converter>
    <xp:this.defaultValue><![CDATA[#{javascript:sessionScope.work_start1
    }]]></xp:this.defaultValue>
    <xp:dateTimeHelper></xp:dateTimeHelper>
</xp:inputText>

Here ́s the code for the date picker which is working correct:

<xp:inputText value="#{Activity.date}" id="dateTimeHelper"
    styleClass="xspInputFieldEditBox" type="date">
    <xp:this.converter>
        <xp:convertDateTime>
            <xp:this.pattern><![CDATA[${javascript:if (Activity.isEditable()){
return "yyyy-MM-dd";
}else{
return "dd MM yyyy";
}}]]></xp:this.pattern>
        </xp:convertDateTime>
    </xp:this.converter>
    <xp:this.defaultValue><![CDATA[#{javascript:if(sessionScope.dateTimeHelper == ""){
return @Today();}else{
return sessionScope.dateTimeHelper}}]]></xp:this.defaultValue>
</xp:inputText>
andikress
  • 31
  • 5

2 Answers2

2

Apologies for the separate answer - I don't have the reputation to comment yet...

As Rich says, the key to getting a native time-picker to display on the device is setting type="time" on the xp:inputText tag. However, Domino uses the type attribute on the xp:convertDateTime tag to determine whether to render a date picker or a time picker. So the way to get a native picker in Unplugged and a time picker in regular XPages is to add type="time" to both the xp:inputText and the xp:convertDateTime elements. Also, to work properly on iOS, the pattern in the converter must use a 24hr clock, i.e. HH:mm rather than hh:mm.

<xp:inputText value="#{document1.Time}" type="time" style="height:29px">
  <xp:this.attrs>
    <xp:attr name="id" value="mobiin"></xp:attr>
    <xp:attr name="data-mini" value="true"></xp:attr>
  </xp:this.attrs>
  <xp:dateTimeHelper id="dateTimeHelper2"></xp:dateTimeHelper>
  <xp:this.converter>
    <xp:convertDateTime type="time" pattern="HH:mm"></xp:convertDateTime>
  </xp:this.converter>
</xp:inputText>
Mark Dixon
  • 48
  • 4
1

This works for me, taking the time from the Time field of the doc - adding a default value for new docs should work:

<xp:inputText value="#{document1.Time}" type="time" style="height:29px">
  <xp:this.attrs>
    <xp:attr name="id" value="mobiin"></xp:attr>
    <xp:attr name="data-mini" value="true"></xp:attr>
  </xp:this.attrs>
  <xp:dateTimeHelper id="dateTimeHelper2"></xp:dateTimeHelper>
  <xp:this.converter>
    <xp:convertDateTime pattern="HH:mm"></xp:convertDateTime>
  </xp:this.converter>
</xp:inputText>
  • mh, it´s setting the value to "HH:mm" format, but the datetimehelper popup is showing date´s. Any help? ` ` – andikress May 23 '14 at 07:31