Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Target function bug #505

Open
RyanKim01 opened this issue Jan 13, 2016 · 0 comments
Open

Target function bug #505

RyanKim01 opened this issue Jan 13, 2016 · 0 comments

Comments

@RyanKim01
Copy link

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 ?

@3lvis 3lvis self-assigned this May 3, 2016
@3lvis 3lvis removed their assignment Jan 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants