Form icon indicating copy to clipboard operation
Form copied to clipboard

Target function bug

Open RyanKim01 opened this issue 9 years ago • 0 comments

I found 2 bugs so far related to target function in Form.

Issue (1) I have a json code like below:

{
   "id":"4_3_section",
   "fields":[
      {
         "id":"4_3_yes_no_question",
         "title":"Question 3",
         "info":"Always \"No\"",
         "type":"select",
         "size":{
            "width":100,
            "height":1
         },
         "validations":{
            "required":true
         },
         "values":[
            {
               "id":0,
               "title":"Not Selected",
               "target":[
                  {
                     "id":"4_3_yes_question",
                     "type":"field",
                     "action":"hide"
                  }
               ]
            },
            {
               "id":1,
               "title":"Yes",
               "target":[
                  {
                     "id":"4_3_yes_question",
                     "type":"field",
                     "action":"show"
                  }
               ]
            },
            {
               "id":2,
               "title":"No",
               "target":[
                  {
                     "id":"4_3_yes_question",
                     "type":"field",
                     "action":"hide"
                  }
               ]
            }
         ]
      },
      {
         "id":"4_3_yes_question",
         "title":"If yes, how many?",
         "type":"text",
         "size":{
            "width":100,
            "height":1
         }
      }
   ]
}

When I first implemented in my app, it didn't work from the beginning. It doesn't hide or show id ("4_3_yes_question"). I deleted this code and reimplemented and found no change. Weird thing is that this happens on certain field and works on other fields. Cannot really find out what is causing this issue.

(2) I implemented a way to persist data in Form. Let's say there is a select type of question in one section. Additionally there are 2 subtitle custom fields and 2 text type of questions in the section. So there are total 5 fields. One select type, two subtitle custom type, two text type. In select type question, I have "yes" and "no" value. When yes is selected, it has target method to show all other 4 fields. When "no" is selected, it hides all other 4 fields. When all 5 fields are shown, and if you repeatedly reversely press "yes" and "no", it hides and shows everything well.

Problem occurs here. Let's say you select "no" so 4 fields are hidden. And you press back to exit FormViewController. You open FormViewController, and the answer selected for select type of question is "no" since I'm persisting data. When I press "yes", it shows 4 fields in mixed up orders. I think this is happening because it does not remember how fields are situated when I reopen the viewcontroller. Have you encountered this, @3lvis ?

RyanKim01 avatar Jan 13 '16 07:01 RyanKim01