Form Self Generating Logic

From All n One's bxp software Wixi

Jump to: navigation, search

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