xsltforms icon indicating copy to clipboard operation
xsltforms copied to clipboard

iText binding issues with ODK based xform

Open JungleGenius opened this issue 5 years ago • 0 comments

Hi Alain,

I have been looking far a wide for a JavaScript based XForms editor. We are using some XForms based on a older version of ODK's JavaRosa using iText for multiple languages. I have played around with the name space but its still throwing an error.

I was hopping for some insight as to where I should be looking if I'm going to need to fork this to support our JavaRosa flavor. Our XFrom code is pasted below:

<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
  <h:head>
    <h:title>QuickForm</h:title>
    <model>
<!-- COMMENT GitHub Posted -->	
	<instance>
        <data id="QuickForm" category="Web Only" tag="Data Collection" revision_date="2019-11-08">
          <device_id/>
          <subscriber_id/>
          <sim_id/>
          <AlarmStatus>NA</AlarmStatus>
          <Form_Version>08NOV2019</Form_Version>
          <SubjectName/>
          <Category/>
          <SubCategory1/>
          <Date/>
          <Location>GPS</Location>
          <GPS/>
          <MGRS/>
          <Latitude/>
          <Longitude/>
          <LocationText/>
          <Photo/>
           <Comment/>
          <AudioComment/>
          <VideoNote/>
          <SubmittedBy/>
        </data>
      </instance>
      <itext>
        <translation lang="eng">
          <text id="/data/AlarmStatus:label">
            <value>Alarm Status</value>
          </text>
          <text id="/data/AlarmStatus:hint">
            <value>Form Revised 08NOV2019</value>
          </text>
          <text id="/data/AlarmStatus:option0">
            <value>High High (Critical)</value>
          </text>
          <text id="/data/AlarmStatus:option1">
            <value>High</value>
          </text>
          <text id="/data/AlarmStatus:option2">
            <value>Neutral (no alarm)</value>
          </text>
          <text id="/data/AlarmStatus:option3">
            <value>Positive (Noteworthy)</value>
          </text>
          <text id="/data/AlarmStatus:option4">
            <value>Positive High (Very Noteworthy)</value>
          </text>
          <text id="/data/SubjectName:label">
            <value>Subject Name</value>
          </text>
          <text id="/data/SubjectName:hint">
            <value>Subject Name</value>
          </text>
          <text id="/data/Category:label">
            <value>Category</value>
          </text>
          <text id="/data/Category:hint">
            <value>From large button interface, select main category</value>
          </text>
          <text id="/data/SubCategory1:label">
            <value>SubCategory1 or Detail</value>
          </text>
          <text id="/data/SubCategory1:hint">
            <value>From large button interface, select the detail or task</value>
          </text>
          <text id="/data/Date:label">
            <value>Date</value>
          </text>
          <text id="/data/Date:hint">
            <value>Current date and time.  Modify here if necessary</value>
          </text>
          <text id="/data/Location:label">
            <value>Location obtained from</value>
          </text>
          <text id="/data/Location:hint">
            <value></value>
          </text>
          <text id="/data/Location:option0">
            <value>GPS location from cellphone</value>
          </text>
          <text id="/data/Location:option1">
            <value>Manually enter MGRS</value>
          </text>
          <text id="/data/Location:option2">
            <value>Manually enter Latitude x Longitude</value>
          </text>
          <text id="/data/Location:option3">
            <value>Text description of the location</value>
          </text>
          <text id="/data/GPS:label">
            <value>GPS</value>
          </text>
          <text id="/data/GPS:hint">
            <value></value>
          </text>
          <text id="/data/MGRS:label">
            <value>MGRS</value>
          </text>
          <text id="/data/MGRS:hint">
            <value>Enter 10-digit or 8-digit MGRS coordinates</value>
          </text>
          <text id="/data/Latitude:label">
            <value>Latitude</value>
          </text>
          <text id="/data/Latitude:hint">
            <value>enter digit Latitude here (Longitude on next screen)</value>
          </text>
          <text id="/data/Longitude:label">
            <value>Longitude</value>
          </text>
          <text id="/data/Longitude:hint">
            <value>enter digital Longitude</value>
          </text>
          <text id="/data/LocationText:label">
            <value>Enter a description of the location in text.  Please use this option ONLY if other coordinate information is unavailable.</value>
          </text>
          <text id="/data/LocationText:hint">
            <value></value>
          </text>
          <text id="/data/Photo:label">
            <value>Photo 1</value>
          </text>
          <text id="/data/Photo:hint">
            <value>A maximum of 5 photos can be captured in this form</value>
          </text>
          <text id="/data/Comment:label">
            <value>Report Text</value>
          </text>
          <text id="/data/Comment:hint">
            <value>Optional:  Add any comments here that help describe the captured photos</value>
          </text>
          <text id="/data/AudioComment:label">
            <value>Audio</value>
          </text>
          <text id="/data/AudioComment:hint">
            <value>Include audio that will be helpful to the report</value>
          </text>
          <text id="/data/VideoNote:label">
            <value>Video</value>
          </text>
          <text id="/data/VideoNote:hint">
            <value>Include video that will be helpful to the report</value>
          </text>
          <text id="/data/SubmittedBy:label">
            <value>Submitted By</value>
          </text>
          <text id="/data/SubmittedBy:hint">
            <value>enter your name or initials as instructed</value>
          </text>
        </translation>
      </itext>
      <bind nodeset="/data/device_id" type="string" jr:preload="property" jr:preloadParams="deviceid"/>
      <bind nodeset="/data/subscriber_id" type="string" jr:preload="property" jr:preloadParams="subscriberid"/>
      <bind nodeset="/data/sim_id" type="string" jr:preload="property" jr:preloadParams="simserial"/> 
      <bind nodeset="/data/AlarmStatus"/>
      <bind nodeset="/data/Form_Version"/>
      <bind nodeset="/data/SubjectName" type="string" required="true()"/>
      <bind nodeset="/data/Category" type="string" required="true()"/>
      <bind nodeset="/data/SubCategory1" type="string"/>
      <bind nodeset="/data/Date" type="dateTime" required="true()"/>
      <bind nodeset="/data/Location" type="select1" required="true()"/>
      <bind nodeset="/data/GPS" type="geopoint" relevant="(/data/Location = 'GPS')"/>
      <bind nodeset="/data/MGRS" type="string" relevant="(/data/Location = 'MGRS')"/>
      <bind nodeset="/data/Latitude" type="decimal" relevant="(/data/Location = 'LatLong')" constraint="(. &gt; -91 and . &lt; 91)"/>
      <bind nodeset="/data/Longitude" type="decimal" relevant="(/data/Location = 'LatLong')" constraint="(. &gt; -181 and . &lt; 181)"/>
      <bind nodeset="/data/LocationText" type="string" relevant="(/data/Location = 'LocationText')"/>
      <bind nodeset="/data/Photo" type="binary"/>
      <bind nodeset="/data/Comment" type="string"/>
      <bind nodeset="/data/AudioComment" type="binary"/>
      <bind nodeset="/data/VideoNote" type="binary"/>
      <bind nodeset="/data/SubmittedBy" type="string"/>
    </model>
  </h:head>
  <h:body>
    <select1 ref="/data/AlarmStatus">
      <label ref="jr:itext('/data/AlarmStatus:label')"/>
      <hint ref="jr:itext('/data/AlarmStatus:hint')"/>
      <item>
        <label ref="jr:itext('/data/AlarmStatus:option0')"/>
        <value>HiHi</value>
      </item>
      <item>
        <label ref="jr:itext('/data/AlarmStatus:option1')"/>
        <value>Hi</value>
      </item>
      <item>
        <label ref="jr:itext('/data/AlarmStatus:option2')"/>
        <value>Neutral</value>
      </item>
      <item>
        <label ref="jr:itext('/data/AlarmStatus:option3')"/>
        <value>Positive</value>
      </item>
      <item>
        <label ref="jr:itext('/data/AlarmStatus:option4')"/>
        <value>PositiveHi</value>
      </item>
    </select1>
    <input ref="/data/SubjectName">
      <label ref="jr:itext('/data/SubjectName:label')"/>
      <hint ref="jr:itext('/data/SubjectName:hint')"/>
    </input>
    <input ref="/data/Category">
      <label ref="jr:itext('/data/Category:label')"/>
      <hint ref="jr:itext('/data/Category:hint')"/>
    </input>
    <input ref="/data/SubCategory1">
      <label ref="jr:itext('/data/SubCategory1:label')"/>
      <hint ref="jr:itext('/data/SubCategory1:hint')"/>
    </input>
    <input ref="/data/Date">
      <label ref="jr:itext('/data/Date:label')"/>
      <hint ref="jr:itext('/data/Date:hint')"/>
    </input>
    <select1 ref="/data/Location">
      <label ref="jr:itext('/data/Location:label')"/>
      <hint ref="jr:itext('/data/Location:hint')"/>
      <item>
        <label ref="jr:itext('/data/Location:option0')"/>
        <value>GPS</value>
      </item>
      <item>
        <label ref="jr:itext('/data/Location:option1')"/>
        <value>MGRS</value>
      </item>
      <item>
        <label ref="jr:itext('/data/Location:option2')"/>
        <value>LatLong</value>
      </item>
      <item>
        <label ref="jr:itext('/data/Location:option3')"/>
        <value>LocationText</value>
      </item>
    </select1>
    <input ref="/data/GPS">
      <label ref="jr:itext('/data/GPS:label')"/>
      <hint ref="jr:itext('/data/GPS:hint')"/>
    </input>
    <input ref="/data/MGRS">
      <label ref="jr:itext('/data/MGRS:label')"/>
      <hint ref="jr:itext('/data/MGRS:hint')"/>
    </input>
    <input ref="/data/Latitude">
      <label ref="jr:itext('/data/Latitude:label')"/>
      <hint ref="jr:itext('/data/Latitude:hint')"/>
    </input>
    <input ref="/data/Longitude">
      <label ref="jr:itext('/data/Longitude:label')"/>
      <hint ref="jr:itext('/data/Longitude:hint')"/>
    </input>
    <input ref="/data/LocationText">
      <label ref="jr:itext('/data/LocationText:label')"/>
      <hint ref="jr:itext('/data/LocationText:hint')"/>
    </input>
    <upload ref="/data/Photo" mediatype="image/*">
      <label ref="jr:itext('/data/Photo:label')"/>
      <hint ref="jr:itext('/data/Photo:hint')"/>
    </upload>
    <input ref="/data/Comment">
      <label ref="jr:itext('/data/Comment:label')"/>
      <hint ref="jr:itext('/data/Comment:hint')"/>
    </input>
    <upload ref="/data/AudioComment" mediatype="audio/*">
      <label ref="jr:itext('/data/AudioComment:label')"/>
      <hint ref="jr:itext('/data/AudioComment:hint')"/>
    </upload>
    <upload ref="/data/VideoNote" mediatype="video/*">
      <label ref="jr:itext('/data/VideoNote:label')"/>
      <hint ref="jr:itext('/data/VideoNote:hint')"/>
    </upload>
    <input ref="/data/SubmittedBy">
      <label ref="jr:itext('/data/SubmittedBy:label')"/>
      <hint ref="jr:itext('/data/SubmittedBy:hint')"/>
    </input>
  </h:body>
</h:html>

JungleGenius avatar Sep 16 '19 19:09 JungleGenius