javirosa / opendatakit

Automatically exported from code.google.com/p/opendatakit
0 stars 0 forks source link

Adding Widget to Current Form #777

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, 

How do i add this Widget into my current form once i have exported it to xml?
<instance>
  <widgets xmlns="widgets">
    <my_image/>
  </widgets>
</instance>

<bind nodeset="/widgets/my_image" type="binary"/>

<h:body>     
  <upload ref="my_image" appearance="signature" mediatype="image/*">
    <hint>Freeform touch signature capture</hint>
    <label>image widget</label>
  </upload>
</h:body>
Cheers

Original issue reported on code.google.com by williamd...@googlemail.com on 1 Mar 2013 at 12:20

GoogleCodeExporter commented 9 years ago
You should be able to use any text editor to edit the xml.

See the documentation here: http://opendatakit.org/help/form-design/
to understand the structure of the XML document, and, in particular, the 3 
parts of the form definition, the instance, bindings and body parts.

Original comment by mitchellsundt@gmail.com on 6 Mar 2013 at 11:33

GoogleCodeExporter commented 9 years ago

Original comment by mitchellsundt@gmail.com on 6 Mar 2013 at 11:42

GoogleCodeExporter commented 9 years ago
Issue 785 has been merged into this issue.

Original comment by mitchellsundt@gmail.com on 6 Mar 2013 at 11:53

GoogleCodeExporter commented 9 years ago

Original comment by mitchellsundt@gmail.com on 6 Mar 2013 at 11:54

GoogleCodeExporter commented 9 years ago
Thank you for that, i have tried to go through the documentation but i still 
keep getting errors from the Validate. I have attached my xml without the above 
in it, i have also attached the error i got after i tried to add it in. Any 
help will be great full. 

Original comment by williamd...@googlemail.com on 7 Mar 2013 at 11:39

Attachments:

GoogleCodeExporter commented 9 years ago
The snippet of XML that you are trying to insert needs to be slightly adjusted 
to fit into the form definition in your Energy 2050 - Survey.xml.

In that form definition, the top-level element in your <instance> is <data>. In 
contrast, in the snippet, the top-level element is <widget>. So the steps are:

(1) insert <my_image/> somewhere underneath: 
<model>
  <instance>
    <data>

(2) add the <bind> statement, but this needs to be modified so that it has the 
same path within the above <instance> section as wherever you placed the 
<my_image/> element.  Assuming that you placed it directly under <data> and not 
nested within any grouping terms, the change is to revise the <bind> statement 
to refer to /data/my_image, rather than /widgets/my_image:

    <bind nodeset="/data/my_image" type="binary"/>

(3) add the <upload> prompt description at the appropriate point in your 
survey. If this fails validate, you may need to change the ref attribute to a 
full path to my_image. In this case, /data/my_image. I.e.,:

<upload ref="/data/my_image" ...

but I think it will work as-is (and supply the /data automatically).

Original comment by mitchellsundt@gmail.com on 7 Mar 2013 at 6:26

GoogleCodeExporter commented 9 years ago
Thank you so much for the help, 

I added the snippet in as instructed and Validate is given no errors, but when 
i try and download the form to my phone i get an error 
Energy 2050 - Survey (ID:Energy-2050-Survey) - XML Syntax Error at Line: 1, 
Column: 2!
Any reason for me getting this, i have attached the new xml with form added. 

Original comment by williamd...@googlemail.com on 8 Mar 2013 at 9:30

Attachments:

GoogleCodeExporter commented 9 years ago
I managed to get the it uploaded, changed the Encoding to UTF-8 without BOM and 
uploaded but now when i try run the form it ODK Collect Crashes

Original comment by williamd...@googlemail.com on 8 Mar 2013 at 3:30

GoogleCodeExporter commented 9 years ago
When you added the <upload, you entered:

<upload ref="/my_image" ...

With the nesting of the signature image, this should have been:

<upload ref="/data/signature/my_image" ...

I'll keep this open as it is curious that Validate did not encounter this 
problem and report it.

Original comment by mitchellsundt@gmail.com on 8 Mar 2013 at 5:36

GoogleCodeExporter commented 9 years ago
Managed to get it working finally, have to change the Encoding back to UTF-8 
without BOM as well as add <?xml version="1.0"?> at the very begining

Original comment by williamd...@googlemail.com on 11 Mar 2013 at 10:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Sorry to be a Pain again but i have run into some issues with the form, i 
continued to build my old for in ODK but when i try and validate it im getting 
this error message - [Fatal Error] Energy%202050%20-%20Survey(1).xml:10:12: The 
content of elements must consist of well-formed character data or markup.
Could you help again please, i dunno were its going wrong

Original comment by williamd...@googlemail.com on 11 Mar 2013 at 12:09

Attachments:

GoogleCodeExporter commented 9 years ago
ok i managed to get it all sorted, the next and final question is, can you set 
the ODK on your own server so the data can go there and not to the Google one 
so you dont need to worry about the billing stuff and space?

Cheers

Original comment by williamd...@googlemail.com on 11 Mar 2013 at 1:12

GoogleCodeExporter commented 9 years ago
Yes, you can install ODK onto your own server. See 
http://opendatakit.org/use/aggregate/

Original comment by mitchellsundt@gmail.com on 11 Mar 2013 at 6:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thank you for all your help, got it working

Original comment by williamd...@googlemail.com on 11 Mar 2013 at 8:35