Fix JavaScript exceptions raised in the survey

The exceptions were raised because some attributes are not defined
depending on which questions were answered; there are explicit changes
in place now to avoid this problem.
Merge pull request #624 from ElDeveloper/javascript-fixes

Fix JavaScript exceptions raised in the survey