Changes

Form Self Generating Logic

1,538 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".  bxp has the ability to generate the JavaScript to create this show/hide effect on the form automatically.
BE 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]]#  3. Go to the Logic Management section# . The Logic Management section will allow you to enter a correct number of options for option in the console on the appropriate typeleft hand side.  [[File:Logic_screen003. There is a limit of 20 answers for each closed typepng|800px]]  4. If more than 20 options, no logic can be added We then need to that type. e.g. Yes/No type has 2 possible turn the optionson.  Firstly we allow the form to use Self Generating Logic We add = True  Next, we set all the logic of the two initially visible options to the questionTrue. The destinations This means all questions are separated by shown when the semi colonform starts. So option   Now, in question 1 ; option 2. To , the left of every Yes / No question is an Id number, it is this Id that is used for you can enter "Logic Branches" in on the branchesright. The input would probably be 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. * 2. Yes / No* Now we need to start by hiding options 3. Text Option 1* and 4. Text Option 2# With all the logic in place, it needs Set their initially visible back to be enabledfalse. At the top of the screen from the Use Self Generating Logic option, choose True  [[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