kobotoolbox / koboform

A Java/GWT based formbuilder (no longer supported). Replaced by dkobo.
2 stars 8 forks source link

Groups Button in KFB #25

Closed Dylan-Gillespie closed 11 years ago

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 08, 2012 14:13:56

Summary: Now that we have Group support in KoBOSync, let's put the Groups button back in KFB and do some testing.

Original issue: http://code.google.com/p/kobo/issues/detail?id=25

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 08, 2012 13:14:30

Owner: neil.hen...@kobotoolbox.org

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 08, 2012 13:34:17

Notes on the Xforms for Groups. A properly formatted Xform with repeating groups is attached.

Things of note: 1) it may repeat or not. There needs to be a checkbox in the add group GUI to indicate if you want this to repeat. repeating is controlled like this:

Below is an instance that contains a repeating group called "Household".

Repeating is controlled in the instance, in the top level group node, here called "Household".

We indicate that it will repeat by including this attribute: jr:template=""

This will repeat: This will not repeat:

In the body of the XML, the questions in the group must be surrounded by Group, Label, and Repeat (if repeating) tags. Here is an example:

Groups can repeat or not repeat, they can also be grouped onto one screen or not. By default questions appear one per screen. To group them on one screen, in the repeat tag, add the attribute appearance="field-list">

  <repeat nodeset="/data/Household" appearance="field-list">

This should work on tablets, though I don't have one for testing. It is not a critical feature.

Attachment: Repeat.xml

Dylan-Gillespie commented 11 years ago

From j...@ethertontech.com on May 10, 2012 17:26:25

I've turned the buttons back and started fixing a lot of the bugs. There are a lot. Seems the repeat and group functionality was about as functional as everything else when I first started working on this. You can see how far I've made it at the BETA site: www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner.html

All I've done is made it so you can add a repeat or group, put a question in it, and save to text or file. I haven't even started on parsing XML with groups or repeats. Also, the XML you show isn't even close to how KF makes xml. It uses "binds" and not "ref." I think I can figure out the difference based on what your XML looks like, but it'd be a lot of work to change the way KF spits out XML, so let me know if that's really what you want me to do. Otherwise, I hope it's current state is good enough. I'll work on importing XML once I hear that the XML it spits out is suitable.

Status: Started

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 11, 2012 17:36:25

Taking this step by step. KFB now has buttons for "Add Group" and "Add Repeat". When added, you also get an option for "Add Group Child" or "Add Repeat Child"

This adds a Group into the Form tree. In the Instance you can see this group:

  <instance>
    <new_form2 id="new_form2">
      <deviceid/>
      <start/>
      <end/>
      <A01/>
      <A02 jr:template=""/>
    </new_form2>
  </instance>

This will make a repeating group automatically. It's the jr:template="" that controls repeating.

To add a question inside the group, you have to have the Group highlighted. To add a question inside the repeat section, you have to have the Repeat highlighted. This can be a little confusing, since you add a question and it moves the highlight to that question. Then you end up adding options to that question instead of a new question. I don't know that this is a problem, it's just that i was trying to add three questions under the repeat and I made a mess by triple clicking.

I was making a test form (obviously) and I tried to Ctrl+Z Undo something. The result is I get an error when I try to save the form, show the XML. I don't know if that's a result of the Group elements or the Undo:

(TypeError): a is null stack: LWc(null,"html/body/group",[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:963 pVc([object Object],"html/body/group",[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1364 LWc([object Object],"html/body/group",[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:963 pVc([object Object],"html/body/group",[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1364 ESc([object Object],"html/body/group",[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1313 nRc([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1322 VYc([object Object],[object Object],[object Object],[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1378 UYc([object Object],[object Object],[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1035 sYc([object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1352 _Nc([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1841 zjd([object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1281 Bjd([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2312 vB([object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:673 xB([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1397 Dh([object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1156 Rs([object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:849 rX([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1397 sX([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1397 et([object Object],[object MouseEvent])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1351 fu([object MouseEvent])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1397 uac([object MouseEvent],[object HTMLTableElement],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2525 ([object MouseEvent])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3733 Ykb((function (a) {var b, c = this;while (c && !(b = c.__listener)) {c = c.parentNode;}c && c.nodeType != 1 && (c = null);b && Lbc(b) && uac(a, c, b);}),[object HTMLTableElement],[object Arguments])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1814 _kb((function (a) {var b, c = this;while (c && !(b = c.__listener)) {c = c.parentNode;}c && c.nodeType != 1 && (c = null);b && Lbc(b) && uac(a, c, b);}),[object HTMLTableElement],[object Arguments])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3236 ([object MouseEvent])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2471 fileName: http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html lineNumber: 963

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 11, 2012 17:37:59

The Most recent autosave was 15 minutes old. Don't we save more often than that?

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 11, 2012 17:44:29

The Buttons are labelled weird. "Group Question" should say "Add Group" "repeating question" should say "Add Repeat section"

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 11, 2012 17:51:05

Having trouble evaluating the XML output, as soon as you add a few things, trying to save will give you an error and you have to start all over.

Save to File...

(TypeError): b is null stack: MEc(null,"new_form2/")@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1635 hqd([object Object],null,[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1339 gqd([object Object],[object Object],[object Object],[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1302 fqd([object Object],[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1360 sYc([object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1352 y$c([object Object],false)@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1024 W$c()@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:8 qlb([object Array],[object Array])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3160 glb([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2561 ulb()@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3769 mlb([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1372 Ykb(mlb,[object Proxy],[object Arguments])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1814 _kb(mlb,[object Proxy],[object Arguments])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3236 ([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2471 (46)@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2745 fileName: http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html lineNumber: 1635


Uncaught exception: com.google.gwt.core.client.JavaScriptException: (TypeError): b is null stack: MEc(null,"new_form2/")@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1635 hqd([object Object],null,[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1339 gqd([object Object],[object Object],[object Object],[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1302 fqd([object Object],[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1360 sYc([object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1352 y$c([object Object],false)@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1024 W$c()@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:8 qlb([object Array],[object Array])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3160 glb([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2561 ulb()@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3769 mlb([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1372 Ykb(mlb,[object Proxy],[object Arguments])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1814 _kb(mlb,[object Proxy],[object Arguments])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3236 ([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2471 (46)@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2745 fileName: http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html lineNumber: 1635 at Unknown.MEc(Unknown Source) at Unknown.hqd(Unknown Source) at Unknown.gqd(Unknown Source) at Unknown.fqd(Unknown Source) at Unknown.sYc(Unknown Source) at Unknown.y$c(Unknown Source) at Unknown.W$c(Unknown Source) at Unknown.qlb(Unknown Source) at Unknown.glb(Unknown Source) at Unknown.ulb(Unknown Source) at Unknown.mlb(Unknown Source) at Unknown.Ykb(Unknown Source) at Unknown._kb(Unknown Source) at Unknown.anonymous(Unknown Source) at Unknown.anonymous(Unknown Source) at Unknown.anonymous(Unknown Source)

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 11, 2012 17:55:30

OK, it happens when you try and add a repeat question, you get an error that starts with "a is null".

(TypeError): a is null stack: LWc(null,"html/body/group",[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:963 pVc([object Object],"html/body/group",[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1364 ESc([object Object],"html/body/group",[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1313 nRc([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1322 VYc([object Object],[object Object],[object Object],[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1378 UYc([object Object],[object Object],[object Object],[object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1035 sYc([object Object],[object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1352 y$c([object Object],true)@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1024 J$c()@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2312 qlb([object Array],[object Array])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3160 glb([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2561 ulb()@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3769 mlb([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1372 Ykb(mlb,[object Proxy],[object Arguments])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:1814 _kb(mlb,[object Proxy],[object Arguments])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:3236 ([object Object])@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2471 (31)@ http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html:2745 fileName: http://www.kobotoolbox.org/koboform/BETA/KoBoFormDesigner/1581359E8E6A5C5F6B61E8092B372E58.cache.html lineNumber: 963

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 11, 2012 18:00:13

To add a question AFTER the group, you have to highlight the question BEFORE the group and click the add button. It's a little weird, we should think about how we decide where questions go.

Dylan-Gillespie commented 11 years ago

From neil.hen...@kobotoolbox.org on May 11, 2012 18:19:45

The first error that comes from the Validator is:

Warning: template node found for ref that is not repeatable; ignoring... [A03]

Attachment: ChildGroupTest.xml

Dylan-Gillespie commented 11 years ago

From j...@ethertontech.com on July 30, 2012 17:17:22

Groups and repeats now work. Though there's probably one or two little bugs hiding around in there. I also rewrote the way KoboForm writes out to XML. It was never built to properly support a form with questions inside of other questions. Now it's way faster, smaller, and better.

Dylan-Gillespie commented 11 years ago

From j...@ethertontech.com on July 30, 2012 17:18:04

Forgot to change the status to "Fixed"

Status: Fixed