Difference between revisions of "Form Self Generating Logic"
From All n One's bxp software Wixi
Philip Lacey (talk | contribs) |
Philip Lacey (talk | contribs) |
||
| Line 1: | Line 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. | 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". | ||
| − | |||
| + | 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: | The procedure is as follows: | ||
| Line 25: | Line 30: | ||
| − | + | == 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. 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 | 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 | ||
Revision as of 11:18, 19 November 2014
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:
- Add all the questions you need to the form. e.g. 3 questions. Yes/No question. Text Answer 1. Text Answer 2.
- Go to the Logic Management section
- 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)
- Yes / No
- Text Option 1
- Text Option 2
- With all the logic in place, it needs to be enabled. At the top of the screen from the Use Self Generating Logic option, choose True.
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. 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.