Changes

Form Self Generating Logic

1,531 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 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 bxp has the ability to generate the JavaScript to create this show/hide effect on the form automatically.
 
= Worked example =
 
== 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]]
# Go to the Logic Management section
3. Go to the Logic Management section. The Logic Management option in the console on the left hand side.
# The Logic Management section 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 the logic of the two options to the question. The destinations are separated by the semi colon. So option 1 ; option 2. To the left of every question is an Id number, it is this Id that is used for the branches. The input would probably be 3;4 if:
* 2[[File:Logic_screen003. Yes / No* 3. Text Option 1* 4. Text Option 2png|800px]]
# 4. With We then need to turn the options on. Firstly we allow the form to use Self Generating Logic = True  Next, we set all the logic in place, it needs initially visible options to be enabledTrue. At This means all questions are shown when the top of form starts.  Now, in question 1, the Yes / No question, you can enter "Logic Branches" in on the screen from right. Put in 3;4 into this box. What this means is that, if the Use Self Generating Logic first optionis chosen, choose Trueshow 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 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.
 
 
Now using the 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 display more than one question at a time. The comma , is used to separate the questions you wish to display for a given option.
 
 
If we add in another text box, i.e. Question 3. This would have an Id of 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
 
 
 
 
[[Category:Module Specific:Form Management]]
[[Category:Topic:Key Concept]]
7,528
edits