Difference between revisions of "Form Self Generating Logic"

From All n One's bxp software Wixi

Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Overview ==
+
= 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.
 
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 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".
 
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.
  
  
== High Level Procedure ==
+
= Worked example =
 +
 
 +
== First Sample Build ==
  
 
The procedure is as follows:
 
The procedure is as follows:
  
# Add all the questions you need to the forme.g. 3 questions.  Yes/No question.  Text Answer 1.  Text Answer 2.
+
1. Create a form (Main Menu > Form Management > Form - Primary Management > Form - Create > Blended and give it a name > Click review the build ) 
# Go to the Logic Management section
+
You will start with :
# 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:
+
 
## Header (Added to all forms by default)
+
[[File:Logic_screen001.png|800px]]
## Yes / No
+
 
## Text Option 1
+
 
## Text Option 2
+
 
#  With all the logic in place, it needs to be enabledAt the top of the screen from the Use Self Generating Logic option, choose True.
+
2. Then we need to add some questions to perform the logic withAdd 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 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 timeThe 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
  
  
== Notes ==
+
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
  
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
 
# Header
 
# Yes / No
 
# Text Option 1
 
# Text Option 2
 
# Text Option 3
 
  
These options are for the vertical delivery.
 
  
  
 
[[Category:Module Specific:Form Management]]
 
[[Category:Module Specific:Form Management]]
 
[[Category:Topic:Key Concept]]
 
[[Category:Topic:Key Concept]]

Latest revision as of 18:22, 29 February 2016

1 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".


bxp has the ability to generate the JavaScript to create this show/hide effect on the form automatically.


2 Worked example

2.1 First Sample Build

The procedure is as follows:

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 :

Logic screen001.png


2. Then we need to add some questions to perform the logic with. Add 3 questions. Yes/No question. Text Answer 1. Text Answer 2.

You should complete this as :


Logic screen002.png


3. Go to the Logic Management section. The Logic Management option in the console on the left hand side.


Logic screen003.png


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.


Logic screen004.png


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:

Logic screen005.png Logic screen006.png Logic screen007.png


2.2 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