Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
en:create:debugging [26.09.2017 17:25] – Correction of some typos up to Filter questions lchnr.weben:create:debugging [08.06.2022 17:25] admin
Line 76: Line 76:
 {{:de:create:scr.debug.info01source.png?nolink|Beispiel für eine Fragebogen-Seite mit Filter}} {{:de:create:scr.debug.info01source.png?nolink|Beispiel für eine Fragebogen-Seite mit Filter}}
  
-The command ''value()'' automatically generates an entry in the debug information. You can look at [[#debug-information|Debug-Information]] , to see that the PHP-Code used the command ''value('AB10')'' to deliver a value of 2. +The command ''value()'' automatically generates an entry in the debug information. You can look at [[#debug-information|Debug-Information]], to see that the PHP-Code used the command ''value('AB10')'' to deliver a value of 2. 
  
 {{ :de:create:scr.debug.info01.png?nolink |Debug-Information zur Filterfrage}} {{ :de:create:scr.debug.info01.png?nolink |Debug-Information zur Filterfrage}}
  
-Further, you can observe that item "AB09" is displayed, but "AB05" is missing in the filter -- since the value of ''2'' deliverd by ''value()'' is unequal to ''1'', for which is being filtered. +Furthermore, you can observe that item "AB09" is displayed, but "AB05" is missing in the filter -- since the value of ''2'' deliverd by ''value()'' is unequal to ''1'' which is being filtered. 
  
  
Line 91: Line 91:
 In this case the command ''debug()'' has been used twice. The parameter is once the identifier of the free text entry "AB11_01" and in the other case the PHP variable ''$num'', in which the result of said calculation is saved in. In this case the command ''debug()'' has been used twice. The parameter is once the identifier of the free text entry "AB11_01" and in the other case the PHP variable ''$num'', in which the result of said calculation is saved in.
  
-In debug mode ''debug()'' generates an output in the questionnaire itself, as well as in the [[#debug-information|Debug-Information]]. In the normal interview you won't see any of it.+In debug mode''debug()'' generates an output in the questionnaire itself, as well as in the [[#debug-information|Debug-Information]]. In the normal interview you won't see any of it.
  
 {{ :de:create:scr.debug.info02.png?nolink |}} {{ :de:create:scr.debug.info02.png?nolink |}}
  
-By first using ''debug()'', SoSci dutifully tells you that the parameter is a string with the content "AB11_01". Further, it will be recognized that it is the identifier of a variable from the data set. Which is why automatically the value (6) of the data set is shown. +By first using ''debug()'', SoSci Survey dutifully tells you that the parameter is a string with the content "AB11_01". Further, it will be recognized that it is the identifier of a variable from the data set. Which is why automatically the value (6) of the data set is shown. 
  
-By the second use of ''debug()'', SoSci will show you which current value of the PHP variable ''$num'' is saved (6). +By the second use of ''debug()'', SoSci Survey will show you which current value of the PHP variable ''$num'' is saved (6). 
  
  
Line 107: Line 107:
 {{:de:create:scr.debug.info03source.png?nolink|Eine Fragebogenseite, die u.U. leer bleibt}} {{:de:create:scr.debug.info03source.png?nolink|Eine Fragebogenseite, die u.U. leer bleibt}}
  
-In the [[#debug-information|Debug-Information]] not only can one observe why item "AB05" is not shown but also that it will automatically continue with page 4.+In the [[#debug-information|Debug-Information]] one can not only observe why item "AB05" is not shown but also that the survey will automatically continue with page 4.
  
 {{ :de:create:scr.debug.info03.png?nolink |beispiel}} {{ :de:create:scr.debug.info03.png?nolink |beispiel}}
  
-Furthermore, on the top left you can find the page numbers "3+4", which means that these pages will be shown at once. This display also results if you use ''[[:de:create:functions:gotopage]]'' : this command takes you directly from one page of the questionnaire to another.+Furthermore, as indicated by page numbers "3+4" on the top left, these pages will be shown at once. This also occurs if you use ''[[:de:create:functions:gotopage]]'': this command takes you directly from one page of the questionnaire to another.
  
  
 ==== Example ==== ==== Example ====
  
-The following PHP code shall if the value of the sum is 25 jump directly to another page of the survey and there (above other questions) show a specific text information -- but the text cannot be found:+The following PHP code shall direct you to another page of the survey and display a text there (above other questions), if the value of the sum is 25. However, the text cannot be found:
  
 <code php> <code php>
Line 127: Line 127:
 Here only the output of the debugging mode will help ([[#debug-information|Debug-Information]]). This shows that the command ''[[:en:create:functions:text]]'' is not being executed, the ''goToPage()'' however is. Thus it is not the filter that produces the problem. Here only the output of the debugging mode will help ([[#debug-information|Debug-Information]]). This shows that the command ''[[:en:create:functions:text]]'' is not being executed, the ''goToPage()'' however is. Thus it is not the filter that produces the problem.
  
-Take a look a the initial of the command:''[[:de:create:functions:gotopage]]''It tells us that it will make you jump to the specific page directly without executing anything else on the page of origin. In this example, not even ''text()''. If you are aware of the cause, the solution is simple: Move ''text()'' in front of ''goTopage()''.+Take a look a the initial of the command:''[[:de:create:functions:gotopage]]''The survey redirects the participant to the specific page without executing anything else on the current page. In this example, not even ''text()''. If you are aware of this, the solution is simple: Move ''text()'' in front of ''goTopage()''.
  
 <code php> <code php>
Line 141: Line 141:
 While the PHP code of SoSci Survey is being executed on the server, [[en:create:javascript|JavaScript]] will run in the browser of the participant. Accordingly the browser is responsible for finding errors and information. While the PHP code of SoSci Survey is being executed on the server, [[en:create:javascript|JavaScript]] will run in the browser of the participant. Accordingly the browser is responsible for finding errors and information.
  
-To do so, the error log is needed. One can find it -- depending on the browser -- at different places. +To do so, the browwser console with its error log is needed: [[:en:general:browser-tools]]
-([[http://webmasters.stackexchange.com/a/77337/30902|Shortcuts (engl.)]], [[https://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors#Step_3:_Diagnosis|Wordpress (engl.)]], [[http://www.stramaxon.com/2013/10/developer-tools-in-browser.html|How to Open Developer Tools (engl.)]]).+
  
 Use the command ''console.log()'' to find additional information in the error log. Accordingly, the following Java script code would, e.g., look for an element with the HTML-ID "AB01_01" -- and display the same in the error log if it finds it.  Use the command ''console.log()'' to find additional information in the error log. Accordingly, the following Java script code would, e.g., look for an element with the HTML-ID "AB01_01" -- and display the same in the error log if it finds it. 
Line 156: Line 155:
  
 Browsers nowadays additionally offer an "inspector" or "DOM Explorer" or the like. This allows for clicking on an item on a given page of the survey (a text box, for example), to find further information (e.g., the HTML_Code incl. the HTML-ID) of said item. Browsers nowadays additionally offer an "inspector" or "DOM Explorer" or the like. This allows for clicking on an item on a given page of the survey (a text box, for example), to find further information (e.g., the HTML_Code incl. the HTML-ID) of said item.
 +
en/create/debugging.txt · Last modified: 04.09.2023 21:31 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki