Changes

Form Self Generating Logic

863 bytes added, 18:22, 29 February 2016
no edit summary
== Overview == 
Within any web page, in order to create a logical path through the script, JavaScript is used to show and hide elements. The principle of self generating logic is that elements show and hide depending on options selected in closed questions. The process initially hides all items and then depending on what options are selected, options are displayed again appropriate to the answers selected.
 
So with a closed question, any number of subsequent questions will be shown or hidden as appropriate. For more information on Open and Closed types click here [[Form_Closed_Vs._Open_Questions]]
 
So for a Yes/No type, If Yes, show Question 1. If No, show Question 2. This is also called logic branching in other systems and approaches. Question 1 and 2 are referred to in BE as "options".
BE has the ability to generate the JavaScript to create this show/hide effect on the form automatically.
bxp has the ability to generate the JavaScript to create this show/hide effect on the form automatically.
=Worked example = High Level Procedure  == First Sample Build ==
The procedure is as follows:
# Add all 1. Create a form (Main Menu > Form Management > Form - Primary Management > Form - Create > Blended and give it a name > Click review the build ) You will start with :  [[File:Logic_screen001.png|800px]]   2. Then we need to add some questions you need to perform the formlogic with. e.g. Add 3 questions. Yes/No question. Text Answer 1. Text Answer 2.  # You should complete this as :   [[File:Logic_screen002.png|800px]]  3. Go to the Logic Management section. The Logic Management option in the console on the left hand side.  [[File:Logic_screen003.png|800px]]  4. We then need to turn the options on. Firstly we allow the form to use Self Generating Logic = True  Next, we set all the initially visible options to True. This means all questions are shown when the form starts.  Now, in question 1, the Yes / No question, you can enter "Logic Branches" in on the right. Put in 3;4 into this box. What this means is that, if the first option is chosen, show item 3. If the second option is chosen show item 4.  Now we need to start by hiding options 3 and 4. Set their initially visible back to false.  [[File:Logic_screen004.png|800px]]#  Notes:* The small number in brackets under Logic Management section Branches shows the limit of options available for this question.* Logic Branches will allow you to enter a correct number of options for the appropriate type. * There is a limit of 20 answers for each closed type. If more than 20 options, no logic can be added to that type. e.g. Yes/No type has 2 possible options. We add   Now using the logic of the two options form we get: [[File:Logic_screen005.png|800px]][[File:Logic_screen006.png|800px]][[File:Logic_screen007.png|800px]]   == Multiple Show / Hides ==  For any given branch, you may wish to the display more than one questionat a time. The destinations are separated by the semi colon. So option 1 ; option 2. comma , To the left of every question is an Id number, it is this Id that is used to separate the questions you wish to display for the branchesa given option. The input would probably be 3;4 if:## 2. Yes / No## 3. Text Option 1## 4. Text Option 2# With all the logic If we add in placeanother text box, it needs to be enabledi.e. Question 3. At the top This would have an Id of the screen from the Use Self Generating Logic option, choose True.5 
Using the example above if we wanted to show a third text option for the No part, then the Logic Branches text would be 3;4,5
== Notes ==
For any given branch, you may wish to display more than one question at a time. The comma , is used to separate the questions you wish to display for a given option. Using the example above if we wanted to show a third text option for the No part, then the text would likely be 3;4,5
# 1. Header
# 2. Yes / No
# 3. Text Option 1
# 4. Text Option 2
# 5. Text Option 2
These options are for the vertical delivery.[[Category:Module Specific:Form Management]][[Category:Topic:Key Concept]]
7,528
edits