Both sides previous revisionPrevious revision | Next revisionBoth sides next revision |
en:create:debugging [22.09.2017 17:22] – johannes.lotz | en:create:debugging [22.09.2017 17:33] – johannes.lotz |
---|
==== Example ==== | ==== Example ==== |
| |
The following PHP code shall after a value of the sum of 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 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: |
| |
<code php> | <code php> |
| |
| |
===== Fehlersuche in JavaScript ===== | ===== Finding Bugs in Java ===== |
| |
Während PHP-Code von SoSci Survey auf dem Befragungsserver ausgeführt wird, läuft [[de:create:javascript|JavaScript]] im Browser beim Teilnehmer. Entsprechend ist der Browser auch dafür verantwortlich, Fehler und Informationen anzuzeigen. | While the PHP code of SoSci Survey is being executed on the server, [[de:create:javascript|JavaScript]] will run in the browser of the participant. Accordingly the browser is responsible for finding errors and information. |
| |
Dafür wird die Fehlerkonsole des Browsers benötigt. Diese findet man -- je nach Browser -- an unterschiedlicher Stelle ([[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.)]]). | To do so, the error log is needed. One can find it -- depending on the browser -- at different places. |
| ([[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.)]]). |
| |
Verwenden Sie den Befehl ''console.log()'', um zusätzliche Informationen in der Fehlerkonsole anzuzeigen. So würde der folgende JavaScript-Code z.B. nach einem Element mit der HTML-ID "AB01_01" suchen -- und in der Fehlerkonsole anzeigen, was er gefunden hat. | 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. |
| |
<code html> | <code html> |
</code> | </code> |
| |
Aktuelle Browser haben zusätzlich einen "Inspektor" oder "DOM Explorer" o.ä., welcher es erlaubt, einfach auf ein Objekt der Fragebogenseite zu klicken (z.B. auf ein Eingabefeld), um zusätzliche Informationen (z.B. den HTML_Code inkl. HTML-ID) zum Objekt anzeigen zu lassen. | 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. |